private static State CreateGoalScoredScenario() { var playerClient = A.Fake <IGlobalSettingsClient>(); A.CallTo(() => playerClient.GetGlobalSettings()).Returns( new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player() } }); var fixtureClient = A.Fake <IFixtureClient>(); A.CallTo(() => fixtureClient.GetFixturesByGameweek(1)).Returns(new List <Fixture> { TestBuilder.AwayTeamGoal(888, 1) }).Once() .Then.Returns( new List <Fixture> { TestBuilder.AwayTeamGoal(888, 2) }); return(CreateBaseScenario(fixtureClient, playerClient)); }
public void NewFixtureWithAdditionalStats_NewEvent() { var fixture = TestBuilder.NoGoals(fixtureCode: 10); var fixtureWithGoal = TestBuilder.AwayTeamGoal(fixtureCode: 10, goals: 1); var events = FixtureDiffer.DiffFixtureStats(newFixture: fixtureWithGoal, fixture); Assert.NotEmpty(events); Assert.Single(events); Assert.Equal(StatType.GoalsScored, events.First().Key); Assert.Equal(TestBuilder.PlayerId, events.First().Value.First().PlayerId); }
public void NewFixtureWithRemovedEvent_NewEvent_WithRemovedFlagTrue() { var fixtureWithGoal = TestBuilder.AwayTeamGoal(fixtureCode: 10, goals: 1); var fixtureGoalRemoved = TestBuilder.NoGoals(fixtureCode: 10); var events = FixtureDiffer.DiffFixtureStats(newFixture: fixtureGoalRemoved, fixtureWithGoal); Assert.NotEmpty(events); Assert.Single(events); Assert.Equal(StatType.GoalsScored, events.First().Key); var playerEvent = events.First().Value.First(); Assert.Equal(TestBuilder.PlayerId, playerEvent.PlayerId); Assert.True(playerEvent.IsRemoved); }
public static void When_NewAwayGoal_ReturnsAwayTeamGoalEvent() { var current = new List <Fixture> { TestBuilder.NoGoals(fixtureCode: 1) }; var latest = new List <Fixture> { TestBuilder.AwayTeamGoal(fixtureCode: 1, goals: 1) }; var events = LiveEventsExtractor.GetUpdatedFixtureEvents(latest, current); var awayGoalEvent = events.First(); Assert.Equal(123, awayGoalEvent.StatMap[StatType.GoalsScored].First().PlayerId); Assert.Equal(PlayerEvent.TeamType.Away, awayGoalEvent.StatMap[StatType.GoalsScored].First().Team); }
private List <FixtureEvents> CreateGoalEvent() { var fixture = TestBuilder.AwayTeamGoal(1, 1); return(new List <FixtureEvents> { new FixtureEvents { GameScore = new GameScore { HomeTeamId = fixture.HomeTeamId, AwayTeamId = fixture.AwayTeamId }, StatMap = new Dictionary <StatType, List <PlayerEvent> > { { StatType.GoalsScored, new List <PlayerEvent> { new PlayerEvent(TestBuilder.Player().Id, PlayerEvent.TeamType.Home, false) } } } } }); }
private static State CreateSingleFinishedFixturesScenario() { var playerClient = A.Fake <IGlobalSettingsClient>(); A.CallTo(() => playerClient.GetGlobalSettings()).Returns( new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player(), TestBuilder.OtherPlayer() } }); var fixtureClient = A.Fake <IFixtureClient>(); A.CallTo(() => fixtureClient.GetFixturesByGameweek(1)).Returns(new List <Fixture> { TestBuilder.AwayTeamGoal(888, 1), TestBuilder.AwayTeamGoal(999, 1) }).Once() .Then.Returns( new List <Fixture> { TestBuilder.AwayTeamGoal(888, 1), TestBuilder.AwayTeamGoal(999, 1).FinishedProvisional() .WithProvisionalBonus(TestBuilder.Player().Id, 10) .WithProvisionalBonus(TestBuilder.OtherPlayer().Id, 20) }); return(CreateBaseScenario(fixtureClient, playerClient)); }