public IEnumerable <Match> MatchesOfaTeamBySportId(Guid idSport, Guid idTeam) { try{ Sport theSport = unitOfWork.SportRepository.GetById(idSport); Team theTeam = unitOfWork.TeamRepository.GetById(idTeam); List <Match> listOfMatches = theTeam.ListOfMatches; List <Match> listToReturn = new List <Match>(); if (!theTeam.WasDeleted) { foreach (Match match in listOfMatches) { if (!match.WasDeleted && theSport.Equals(match.KindOfSport)) { listToReturn.Add(match); } } return(listToReturn); } else { throw new InvalidOperationException("Could not get the team - Team was deleted"); } }catch (ArgumentNullException) { throw new InvalidOperationException("Could not get the team - Team does not exist"); } }
public void EqualsShouldBeFalse2Test() { var firstSport = new Sport() { Name = "SomeName" }; Assert.IsFalse(firstSport.Equals(null)); }
public bool IsCorrectTheSpor(Sport sportOne, Sport sportTwo) { bool isTheSameSport = false; if (sportOne.Equals(sportTwo)) { isTheSameSport = true; } return(isTheSameSport); }
public void NotEqualsDifferentTypeTest() { Sport aSport = new Sport("SportA", true); Assert.IsFalse(aSport.Equals("different type")); }
public void NotEqualsNullTest() { Sport aSport = new Sport("SportA", true); Assert.IsFalse(aSport.Equals(null)); }