示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#4
0
        private LineupState CreateTwoNewLineupsScenario()
        {
            var fixtureClient = A.Fake <IFixtureClient>();
            var testFixture1  = TestBuilder.NoGoals(1);
            var testFixture2  = TestBuilder.NoGoals(2);

            A.CallTo(() => fixtureClient.GetFixturesByGameweek(1)).Returns(new List <Fixture>
            {
                testFixture1,
                testFixture2
            });

            var scraperFake = A.Fake <IGetMatchDetails>();

            A.CallTo(() => scraperFake.GetMatchDetails(testFixture1.PulseId)).Returns(TestBuilder.NoLineup(testFixture1.PulseId)).Once().Then.Returns(TestBuilder.Lineup(testFixture1.PulseId));;
            A.CallTo(() => scraperFake.GetMatchDetails(testFixture2.PulseId)).Returns(TestBuilder.NoLineup(testFixture2.PulseId)).Once().Then.Returns(TestBuilder.Lineup(testFixture2.PulseId));
            _mediator = A.Fake <IMediator>();
            return(new LineupState(fixtureClient, scraperFake, _mediator, A.Fake <ILogger <LineupState> >()));
        }