package tests

import (
	"testing"

	"github.com/akiver/cs-demo-analyzer/pkg/api"
	"github.com/akiver/cs-demo-analyzer/pkg/api/constants"
	"github.com/akiver/cs-demo-analyzer/tests/assertion"
	"github.com/akiver/cs-demo-analyzer/tests/fake"
	"github.com/akiver/cs-demo-analyzer/tests/testsutils"

	"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common"
	"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
)

func TestEsea_12283595_Cache(t *testing.T) {
	demoName := "esea_match_12283595_cache"
	demoPath := testsutils.GetDemoPath("csgo", demoName)
	match, err := api.AnalyzeDemo(demoPath, api.AnalyzeDemoOptions{
		Source: constants.DemoSourceESEA,
	})
	if err != nil {
		t.Error(err)
	}

	expectedRoundCount := 28
	expectedPlayerCount := 10
	expectedScoreTeamA := 12
	expectedScoreTeamB := 16
	expectedScoreFirstHalfTeamA := 9
	expectedScoreFirstHalfTeamB := 6
	expectedScoreSecondHalfTeamA := 3
	expectedScoreSecondHalfTeamB := 10
	expectedTeamNameA := "Team A"
	expectedTeamNameB := "Team B"
	expectedWinnerName := expectedTeamNameB
	expectedMaxRounds := 30

	if len(match.Rounds) != expectedRoundCount {
		t.Errorf("expected %d rounds but got %d", expectedRoundCount, len(match.Rounds))
	}
	if len(match.Players()) != expectedPlayerCount {
		t.Errorf("expected %d players but got %d", expectedPlayerCount, len(match.Players()))
	}
	if match.TeamA.Score != expectedScoreTeamA {
		t.Errorf("expected score team A to be %d got %d", expectedScoreTeamA, match.TeamA.Score)
	}
	if match.TeamB.Score != expectedScoreTeamB {
		t.Errorf("expected score team B to be %d got %d", expectedScoreTeamB, match.TeamB.Score)
	}
	if match.TeamA.Name != expectedTeamNameA {
		t.Errorf("expected team name A to be %s got %s", expectedTeamNameA, match.TeamA.Name)
	}
	if match.TeamB.Name != expectedTeamNameB {
		t.Errorf("expected team name B to be %s got %s", expectedTeamNameB, match.TeamB.Name)
	}
	if match.TeamA.ScoreFirstHalf != expectedScoreFirstHalfTeamA {
		t.Errorf("expected score first half team A to be %d got %d", expectedScoreFirstHalfTeamA, match.TeamA.ScoreFirstHalf)
	}
	if match.TeamB.ScoreFirstHalf != expectedScoreFirstHalfTeamB {
		t.Errorf("expected score first half team B to be %d got %d", expectedScoreFirstHalfTeamB, match.TeamB.ScoreFirstHalf)
	}
	if match.TeamA.ScoreSecondHalf != expectedScoreSecondHalfTeamA {
		t.Errorf("expected score second half team A to be %d got %d", expectedScoreSecondHalfTeamA, match.TeamA.ScoreSecondHalf)
	}
	if match.TeamB.ScoreSecondHalf != expectedScoreSecondHalfTeamB {
		t.Errorf("expected score second half team B to be %d got %d", expectedScoreSecondHalfTeamB, match.TeamB.ScoreSecondHalf)
	}
	if match.Winner.Name != expectedWinnerName {
		t.Errorf("expected winner to be %s but got %s", expectedWinnerName, match.Winner.Name)
	}
	if match.MaxRounds != expectedMaxRounds {
		t.Errorf("expected max rounds to be %d but got %d", expectedMaxRounds, match.MaxRounds)
	}

	var playerEconomies = []api.PlayerEconomy{
		{
			RoundNumber:    1,
			SteamID64:      76561198374711223,
			Name:           "bl1tz^",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198180456121,
			Name:           "1dean",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198801254407,
			Name:           "Hert",
			StartMoney:     800,
			MoneySpent:     800,
			EquipmentValue: 800,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561197987049310,
			Name:           "✪ koga",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198371512291,
			Name:           "Dieh4rdz",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198045739791,
			Name:           "Polyglot_ENT",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198263387212,
			Name:           "-BlueDreamz-",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198309528483,
			Name:           "Chapd",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198088170603,
			Name:           "BrettBunsen",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    1,
			SteamID64:      76561198155133875,
			Name:           "zane---",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 700,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198374711223,
			Name:           "bl1tz^",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198180456121,
			Name:           "1dean",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198801254407,
			Name:           "Hert",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561197987049310,
			Name:           "✪ koga",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198371512291,
			Name:           "Dieh4rdz",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198045739791,
			Name:           "Polyglot_ENT",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198263387212,
			Name:           "-BlueDreamz-",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198309528483,
			Name:           "Chapd",
			StartMoney:     800,
			MoneySpent:     700,
			EquipmentValue: 900,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198088170603,
			Name:           "BrettBunsen",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    16,
			SteamID64:      76561198155133875,
			Name:           "zane---",
			StartMoney:     800,
			MoneySpent:     650,
			EquipmentValue: 850,
			Type:           constants.EconomyTypePistol,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198374711223,
			Name:           "bl1tz^",
			StartMoney:     3350,
			MoneySpent:     3250,
			EquipmentValue: 3450,
			Type:           constants.EconomyTypeSemi,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198180456121,
			Name:           "1dean",
			StartMoney:     1850,
			MoneySpent:     1700,
			EquipmentValue: 1700,
			Type:           constants.EconomyTypeForceBuy,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198801254407,
			Name:           "Hert",
			StartMoney:     3950,
			MoneySpent:     2650,
			EquipmentValue: 2850,
			Type:           constants.EconomyTypeSemi,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561197987049310,
			Name:           "✪ koga",
			StartMoney:     3650,
			MoneySpent:     3550,
			EquipmentValue: 3800,
			Type:           constants.EconomyTypeSemi,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198371512291,
			Name:           "Dieh4rdz",
			StartMoney:     1850,
			MoneySpent:     1350,
			EquipmentValue: 1350,
			Type:           constants.EconomyTypeSemi,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198045739791,
			Name:           "Polyglot_ENT",
			StartMoney:     3350,
			MoneySpent:     3350,
			EquipmentValue: 3550,
			Type:           constants.EconomyTypeSemi,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198263387212,
			Name:           "-BlueDreamz-",
			StartMoney:     1850,
			MoneySpent:     1700,
			EquipmentValue: 1700,
			Type:           constants.EconomyTypeForceBuy,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198309528483,
			Name:           "Chapd",
			StartMoney:     1500,
			MoneySpent:     1350,
			EquipmentValue: 1350,
			Type:           constants.EconomyTypeForceBuy,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198088170603,
			Name:           "BrettBunsen",
			StartMoney:     1550,
			MoneySpent:     300,
			EquipmentValue: 300,
			Type:           constants.EconomyTypeEco,
		},
		{
			RoundNumber:    17,
			SteamID64:      76561198155133875,
			Name:           "zane---",
			StartMoney:     4000,
			MoneySpent:     3300,
			EquipmentValue: 3500,
			Type:           constants.EconomyTypeSemi,
		},
	}

	var rounds = []fake.FakeRound{
		{
			Number:            1,
			StartTick:         1455,
			StartFrame:        725,
			EndTick:           9347,
			FreezeTimeEndTick: 3369,
			TeamAStartMoney:   4000,
			TeamBStartMoney:   4000,
			TeamAEconomyType:  constants.EconomyTypePistol,
			TeamBEconomyType:  constants.EconomyTypePistol,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        0,
			TeamBScore:        1,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            2,
			StartTick:         9998,
			StartFrame:        4994,
			EndTick:           17016,
			FreezeTimeEndTick: 11912,
			TeamAStartMoney:   8300,
			TeamBStartMoney:   18450,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        1,
			TeamBScore:        1,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            3,
			StartTick:         17667,
			StartFrame:        8826,
			FreezeTimeEndTick: 19581,
			EndTick:           32249,
			TeamAStartMoney:   20350,
			TeamBStartMoney:   9350,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        2,
			TeamBScore:        1,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            4,
			StartTick:         32898,
			StartFrame:        16439,
			FreezeTimeEndTick: 34813,
			EndTick:           39113,
			TeamAStartMoney:   26000,
			TeamBStartMoney:   10950,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        3,
			TeamBScore:        1,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            5,
			StartTick:         39757,
			StartFrame:        19868,
			FreezeTimeEndTick: 41677,
			EndTick:           52433,
			TeamAStartMoney:   26550,
			TeamBStartMoney:   23050,
			EndReason:         events.RoundEndReasonBombDefused,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        4,
			TeamBScore:        1,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            6,
			StartTick:         53073,
			StartFrame:        26524,
			FreezeTimeEndTick: 54993,
			EndTick:           65209,
			TeamAStartMoney:   31000,
			TeamBStartMoney:   20150,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        4,
			TeamBScore:        2,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            7,
			StartTick:         65853,
			StartFrame:        32912,
			FreezeTimeEndTick: 67774,
			EndTick:           80066,
			TeamAStartMoney:   24900,
			TeamBStartMoney:   18800,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        5,
			TeamBScore:        2,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            8,
			StartTick:         80710,
			StartFrame:        40338,
			FreezeTimeEndTick: 82631,
			EndTick:           91569,
			TeamAStartMoney:   18700,
			TeamBStartMoney:   11650,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        5,
			TeamBScore:        3,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            9,
			StartTick:         92211,
			StartFrame:        46086,
			FreezeTimeEndTick: 94132,
			EndTick:           106148,
			TeamAStartMoney:   11050,
			TeamBStartMoney:   20350,
			EndReason:         events.RoundEndReasonTargetBombed,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        5,
			TeamBScore:        4,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            10,
			StartTick:         106793,
			StartFrame:        53372,
			FreezeTimeEndTick: 108707,
			EndTick:           115722,
			TeamAStartMoney:   17250,
			TeamBStartMoney:   25350,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        6,
			TeamBScore:        4,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            11,
			StartTick:         116369,
			StartFrame:        58157,
			FreezeTimeEndTick: 118283,
			EndTick:           126083,
			TeamAStartMoney:   28950,
			TeamBStartMoney:   12300,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        7,
			TeamBScore:        4,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            12,
			StartTick:         126727,
			StartFrame:        63336,
			FreezeTimeEndTick: 128647,
			EndTick:           133907,
			TeamAStartMoney:   25800,
			TeamBStartMoney:   10750,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        8,
			TeamBScore:        4,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            13,
			StartTick:         134551,
			StartFrame:        67246,
			FreezeTimeEndTick: 136471,
			EndTick:           148936,
			TeamAStartMoney:   27300,
			TeamBStartMoney:   22150,
			EndReason:         events.RoundEndReasonTargetBombed,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        8,
			TeamBScore:        5,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            14,
			StartTick:         149576,
			StartFrame:        74756,
			FreezeTimeEndTick: 151496,
			EndTick:           160116,
			TeamAStartMoney:   29950,
			TeamBStartMoney:   19450,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        5,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            15,
			StartTick:         160760,
			StartFrame:        80346,
			FreezeTimeEndTick: 162680,
			EndTick:           168816,
			TeamAStartMoney:   26050,
			TeamBStartMoney:   12100,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        9,
			TeamBScore:        6,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamCounterTerrorists,
			TeamBSide:         common.TeamTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            16,
			StartTick:         174315,
			StartFrame:        87109,
			FreezeTimeEndTick: 176229,
			EndTick:           181929,
			TeamAStartMoney:   4000,
			TeamBStartMoney:   4000,
			TeamAEconomyType:  constants.EconomyTypePistol,
			TeamBEconomyType:  constants.EconomyTypePistol,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        7,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            17,
			StartTick:         182574,
			StartFrame:        91236,
			FreezeTimeEndTick: 184488,
			EndTick:           190298,
			TeamAStartMoney:   8600,
			TeamBStartMoney:   18300,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        8,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            18,
			StartTick:         190940,
			StartFrame:        95419,
			FreezeTimeEndTick: 192860,
			EndTick:           195134,
			TeamAStartMoney:   11700,
			TeamBStartMoney:   21450,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        9,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            19,
			StartTick:         195778,
			StartFrame:        97836,
			FreezeTimeEndTick: 197698,
			EndTick:           205046,
			TeamAStartMoney:   23050,
			TeamBStartMoney:   37300,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        10,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            20,
			StartTick:         205697,
			StartFrame:        102791,
			FreezeTimeEndTick: 207611,
			EndTick:           218083,
			TeamAStartMoney:   14950,
			TeamBStartMoney:   36550,
			EndReason:         events.RoundEndReasonBombDefused,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        11,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            21,
			StartTick:         218728,
			StartFrame:        109304,
			FreezeTimeEndTick: 220642,
			EndTick:           233114,
			TeamAStartMoney:   32050,
			TeamBStartMoney:   43400,
			EndReason:         events.RoundEndReasonBombDefused,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        12,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            22,
			StartTick:         233754,
			StartFrame:        116816,
			FreezeTimeEndTick: 235675,
			EndTick:           248159,
			TeamAStartMoney:   29100,
			TeamBStartMoney:   43050,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        13,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            23,
			StartTick:         248808,
			StartFrame:        124338,
			FreezeTimeEndTick: 250722,
			EndTick:           256976,
			TeamAStartMoney:   23500,
			TeamBStartMoney:   42600,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        14,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            24,
			StartTick:         257622,
			StartFrame:        128745,
			FreezeTimeEndTick: 259543,
			EndTick:           265875,
			TeamAStartMoney:   19850,
			TeamBStartMoney:   48600,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        9,
			TeamBScore:        15,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            25,
			StartTick:         266524,
			StartFrame:        133191,
			FreezeTimeEndTick: 268438,
			EndTick:           278242,
			TeamAStartMoney:   18400,
			TeamBStartMoney:   49850,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        10,
			TeamBScore:        15,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            26,
			StartTick:         278891,
			StartFrame:        139372,
			FreezeTimeEndTick: 280805,
			EndTick:           290591,
			TeamAStartMoney:   20400,
			TeamBStartMoney:   43550,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        11,
			TeamBScore:        15,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            27,
			StartTick:         291237,
			StartFrame:        145545,
			FreezeTimeEndTick: 293158,
			EndTick:           297950,
			TeamAStartMoney:   26800,
			TeamBStartMoney:   25050,
			EndReason:         events.RoundEndReasonTerroristsWin,
			WinnerSide:        common.TeamTerrorists,
			TeamAScore:        12,
			TeamBScore:        15,
			WinnerName:        expectedTeamNameA,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
		{
			Number:            28,
			StartTick:         298594,
			StartFrame:        149221,
			FreezeTimeEndTick: 300514,
			EndTick:           311734,
			TeamAStartMoney:   24850,
			TeamBStartMoney:   23450,
			EndReason:         events.RoundEndReasonCTWin,
			WinnerSide:        common.TeamCounterTerrorists,
			TeamAScore:        12,
			TeamBScore:        16,
			WinnerName:        expectedTeamNameB,
			TeamASide:         common.TeamTerrorists,
			TeamBSide:         common.TeamCounterTerrorists,
			TeamAName:         expectedTeamNameA,
			TeamBName:         expectedTeamNameB,
		},
	}

	var players = []fake.FakePlayer{
		{
			SteamID64:     76561198374711223,
			Name:          "bl1tz^",
			KillCount:     16,
			AssistCount:   4,
			DeathCount:    22,
			Score:         22,
			Team:          match.TeamB,
			HeadshotCount: 10,
			UtilityDamage: 65,
		},
		{
			SteamID64:     76561198180456121,
			Name:          "1dean",
			KillCount:     24,
			AssistCount:   3,
			DeathCount:    17,
			Score:         30,
			Team:          match.TeamA,
			HeadshotCount: 2,
			UtilityDamage: 79,
		},
		{
			SteamID64:     76561198801254407,
			Name:          "Hert",
			KillCount:     30,
			AssistCount:   2,
			DeathCount:    15,
			Score:         35,
			Team:          match.TeamB,
			HeadshotCount: 8,
			UtilityDamage: 212,
		},
		{
			SteamID64:     76561197987049310,
			Name:          "✪ koga",
			KillCount:     26,
			AssistCount:   4,
			DeathCount:    19,
			Score:         33,
			Team:          match.TeamB,
			HeadshotCount: 13,
			UtilityDamage: 0,
		},
		{
			SteamID64:     76561198371512291,
			Name:          "Dieh4rdz",
			KillCount:     19,
			AssistCount:   4,
			DeathCount:    22,
			Score:         14,
			Team:          match.TeamA,
			HeadshotCount: 8,
			UtilityDamage: 0,
		},
		{
			SteamID64:     76561198045739791,
			Name:          "Polyglot_ENT",
			KillCount:     15,
			AssistCount:   2,
			DeathCount:    15,
			Score:         16,
			Team:          match.TeamB,
			HeadshotCount: 5,
			UtilityDamage: 0,
		},
		{
			SteamID64:     76561198263387212,
			Name:          "-BlueDreamz-",
			KillCount:     13,
			AssistCount:   5,
			DeathCount:    22,
			Score:         9,
			Team:          match.TeamA,
			HeadshotCount: 1,
			UtilityDamage: 32,
		},
		{
			SteamID64:     76561198309528483,
			Name:          "Chapd",
			KillCount:     18,
			AssistCount:   3,
			DeathCount:    22,
			Score:         14,
			Team:          match.TeamA,
			HeadshotCount: 8,
			UtilityDamage: 122,
		},
		{
			SteamID64:     76561198088170603,
			Name:          "BrettBunsen",
			KillCount:     19,
			AssistCount:   4,
			DeathCount:    21,
			Score:         13,
			Team:          match.TeamA,
			HeadshotCount: 0,
			UtilityDamage: 39,
		},
		{
			SteamID64:     76561198155133875,
			Name:          "zane---",
			KillCount:     17,
			AssistCount:   5,
			DeathCount:    22,
			Score:         24,
			Team:          match.TeamB,
			HeadshotCount: 8,
			UtilityDamage: 0,
		},
	}

	assertion.AssertPlayers(t, match, players)
	assertion.AssertRounds(t, match, rounds)
	assertion.AssertPlayerEconomies(t, match, playerEconomies)
}
