Ejemplo n.º 1
0
        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
             }
         }
     });
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
 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>()
     });
 }
Ejemplo n.º 7
0
        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));
        }