public List <Match> CreateMatches(List <Match> matches) { try { foreach (Match match in matches) { _matchVali.CheckIfMatchIsNull(match); _matchVali.ValidateMatch(match); _matchVali.ValidateMatchStartDate(match); } return(_matchRepo.CreateMatch(matches).ToList()); }catch (Exception ex) { throw ex; } }
public void TestThrowsExceptionIfMatchIsNull() { MatchValidator matchVali = new MatchValidator(); Match match = null; Exception ex = Assert.Throws <InvalidDataException>(() => matchVali.CheckIfMatchIsNull(match)); Assert.Equal("Match must be something", ex.Message); }