Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }