Пример #1
0
        public void AddFixtureTeamAlreadyHasMatchTest()
        {
            AddSportAndTeams();
            testFixture.fixtureName = (typeof(OneMatchFixture)).ToString();
            fixtureService.SetFixtureAlgorithm(testFixture, algorithmPaths);
            Encounter aMatch = factory.CreateEncounter(new List <Team>()
            {
                teamA, teamB
            }, testFixture.initialDate, sport);

            matchStorage.Add(aMatch);
            ICollection <EncounterDto> matchesAdded = fixtureService.AddFixture(teamsNames, sport.Name);

            Assert.IsTrue(matchStorage.IsEmpty());
        }
Пример #2
0
 public Encounter AddEncounter(Encounter toAdd)
 {
     try
     {
         ValidateDate(toAdd);
         return(encountersStorage.Add(toAdd));
     }
     catch (EncounterAlreadyExistsException e)
     {
         throw new ServiceException(e.Message, ErrorType.ENTITY_ALREADY_EXISTS);
     }
     catch (DataInaccessibleException e) {
         throw new ServiceException(e.Message, ErrorType.DATA_INACCESSIBLE);
     }
 }
Пример #3
0
        public void DeleteWithMatchesTest()
        {
            Sport played = new Sport("Soccer", true);
            Team  team1  = new Team(1, "DreamTeam", "MyResources/DreamTeam.png", played);
            Team  team2  = new Team(2, "DreamTeam2", "MyResources/DreamTeam2.png", played);
            Match match  = new Match(1, new List <Team>()
            {
                team1, team2
            }, DateTime.Now, played);

            teamsStorage.Add(team1);
            teamsStorage.Add(team2);
            matchesStorage.Add(match);
            teamsStorage.Delete(1);
            Assert.IsTrue(matchesStorage.IsEmpty());
        }
 public void ClearTest()
 {
     matchesStorage.Add(match);
     matchesStorage.Clear();
     Assert.IsTrue(matchesStorage.IsEmpty());
 }
        public void CommentOnMatchByIdsTest()
        {
            UserId identity = new UserId()
            {
                Name = "name", Surname = "surname", UserName = "******", Password = "******", Email = "*****@*****.**"
            };
            User commentarist = new User(identity, true);

            teamsRepo.Add(teamA);
            teamsRepo.Add(teamB);
            usersRepo.Add(commentarist);
            Encounter added = matchesRepo.Add(matchAvsB);

            SetUpRepository();
            serviceToTest.CommentOnEncounter(added.Id, commentarist.UserName, "a Comment");
        }