Exemple #1
0
        public void SampleAutoRoundRobinFixtureWithTheSameTeamTest()
        {
            List <Team> teams = new List <Team>()
            {
                felix, liverpool, river, cerro, penhiarol, torque, cerro
            };

            DateTime start = new DateTime(3018, 10, 07);

            IFixtureGenerator leagueFixture = new RoundRobin();

            List <Encounter> result = leagueFixture.GenerateFixture(teams, start).ToList();
        }
Exemple #2
0
        public void SampleAutoRoundRobinFixtureTest2()
        {
            List <Team> teams = new List <Team>()
            {
                felix, liverpool, river, cerro, penhiarol, torque
            };

            DateTime start = new DateTime(3018, 10, 07);

            IFixtureGenerator leagueFixture = new RoundRobin();

            List <Encounter> result = leagueFixture.GenerateFixture(teams, start).ToList();

            Assert.AreEqual(15, result.Count);
        }
Exemple #3
0
        public void SampleAutoRoundRobinFixtureWithEmptyTeams()
        {
            Sport       football = new Sport("football");
            List <Team> teams    = new List <Team>()
            {
            };

            DateTime start = new DateTime(3018, 10, 07);

            IFixtureGenerator leagueFixture = new RoundRobin();

            List <Encounter> result = leagueFixture.GenerateFixture(teams, start).ToList();

            Assert.AreEqual(0, result.Count);
        }
Exemple #4
0
        public void DeleteEncounter()
        {
            login.CreateSession("sSanchez", "user");
            EncounterSimpleServices encounterSimpleServices = new EncounterSimpleServices(login, encounterRepo, sportRepo, teamRepo, userRepo, commentRepo);
            IEnumerable <Team>      teams = new List <Team> {
                felix, river
            };
            DateTime date = new DateTime(3018, 10, 12);

            IFixtureGenerator       fixture    = new RoundRobin();
            IEnumerable <Encounter> encounters = fixture.GenerateFixture(teams, date);

            encounterSimpleServices.CreateEncounter(encounters.Select(e => mapper.Map(e)));
            IEnumerable <EncounterDTO> allEncounters = encounterSimpleServices.GetAllEncounters();

            encounterSimpleServices.DeleteEncounter(allEncounters.First().Id.ToString());

            Assert.IsTrue(encounterSimpleServices.GetAllEncounters().ToList().Count == 0);
        }
Exemple #5
0
        public void GetAllEncounters()
        {
            login.CreateSession("sSanchez", "user");
            EncounterSimpleServices encounterSimpleServices = new EncounterSimpleServices(login, encounterRepo, sportRepo, teamRepo, userRepo, commentRepo);
            EncounterQueryServices  encounterQueryServices  = new EncounterQueryServices(login, encounterRepo, sportRepo, teamRepo, userRepo, commentRepo);
            IEnumerable <Team>      teams = new List <Team> {
                felix, river
            };
            DateTime          date    = new DateTime(3018, 10, 12);
            IFixtureGenerator fixture = new RoundRobin();

            SilverFixture.Services.DTO_Mappers.EncounterMapper mapper = new SilverFixture.Services.DTO_Mappers.EncounterMapper(sportRepo, teamRepo, commentRepo);
            IEnumerable <Encounter> encounters = fixture.GenerateFixture(teams, date);

            encounterSimpleServices.CreateEncounter(encounters.Select(e => mapper.Map(e)));

            IEnumerable <Encounter> result = encounterSimpleServices.GetAllEncounters().Select(e => mapper.Map(e));
            bool areAllPresent             = encounters.All(i => result.ToList().Remove(i));

            Assert.IsTrue(areAllPresent);
        }