private static State CreatePriceIncreaseScenario() { 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() } } ).Once().Then.Returns(new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player().WithCostChangeEvent(1) } }); var fixtureClient = A.Fake <IFixtureClient>(); return(CreateBaseScenario(fixtureClient, playerClient)); }
private GameweekLeagueContext CreateTransferOutForGoalScorerContext(string slackUserRealName, string slackUserHandle, string entryName) { return(new GameweekLeagueContext { Users = new[] { new User { Real_name = slackUserRealName, Name = slackUserHandle } }, Players = new List <Player> { TestBuilder.Player() }, Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, SlackTeam = new SlackTeam { Subscriptions = new [] { EventSubscription.All } }, TransfersForLeague = new [] { new TransfersByGameWeek.Transfer { EntryId = 2, EntryName = entryName, PlayerTransferredOut = TestBuilder.PlayerId } } }); }
private static State CreateChangeInDoubtfulnessScenario() { var settingsClient = A.Fake <IGlobalSettingsClient>(); A.CallTo(() => settingsClient.GetGlobalSettings()).Returns(new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player().WithStatus(PlayerStatuses.Doubtful).WithNews("Knock - 75% chance of playing"), } } ).Once().Then.Returns(new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player().WithStatus(PlayerStatuses.Doubtful).WithNews("Knock - 25% chance of playing") } }); var fixtureClient = A.Fake <IFixtureClient>(); return(CreateBaseScenario(fixtureClient, settingsClient)); }
private static State CreateNewPlayerScenario() { var settingsClient = A.Fake <IGlobalSettingsClient>(); A.CallTo(() => settingsClient.GetGlobalSettings()).Returns(new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player().WithStatus(PlayerStatuses.Available) } } ).Once().Then.Returns(new GlobalSettings { Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, Players = new List <Player> { TestBuilder.Player().WithStatus(PlayerStatuses.Available), TestBuilder.OtherPlayer().WithStatus(PlayerStatuses.Available) } }); var fixtureClient = A.Fake <IFixtureClient>(); return(CreateBaseScenario(fixtureClient, settingsClient)); }
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 GetChangedPlayers_WhenSamePlayersWithPriceChange_ReturnsNoChanges() { var before = new List <Player> { TestBuilder.Player().WithCostChangeEvent(1) }; var after = new List <Player> { TestBuilder.Player().WithCostChangeEvent(1) }; var priceChanges = PlayerChangesEventsExtractor.GetPriceChanges(after, before, new List <Team>()); Assert.Empty(priceChanges); }
public void GetChangedPlayers_WhenSamePlayersWithChangeInPriceChange_ReturnsChanges() { var before = new List <Player> { TestBuilder.Player().WithCostChangeEvent(0) }; var after = new List <Player> { TestBuilder.Player().WithCostChangeEvent(1) }; var priceChanges = PlayerChangesEventsExtractor.GetPriceChanges(after, before, new List <Team>()); Assert.Single(priceChanges); Assert.Equal(TestBuilder.Player().SecondName, priceChanges.First().ToPlayer.SecondName); }
public void GetChangedPlayers_WhenSamePlayersWithChangeInPriceRemoved_ReturnsNoChanges() { var before = new List <Player> { TestBuilder.Player().WithCostChangeEvent(1) }; var after = new List <Player> { TestBuilder.Player().WithCostChangeEvent(0) }; var priceChanges = PlayerChangesEventsExtractor.GetPriceChanges(after, before, new List <Team> { new Team() }); _helper.WriteLine(Formatter.FormatPriceChanged(priceChanges)); Assert.Single(priceChanges); }
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 GameweekLeagueContext CreateNoTransfersForGoalScorer() { return(new GameweekLeagueContext { Users = new[] { new User { Real_name = "dontCare dontCaresen", Name = "dontCareName" } }, Players = new List <Player> { TestBuilder.Player() }, Teams = new List <Team> { TestBuilder.HomeTeam(), TestBuilder.AwayTeam() }, SlackTeam = new SlackTeam { Subscriptions = new [] { EventSubscription.All } }, TransfersForLeague = new List <TransfersByGameWeek.Transfer>() }); }
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)); }