Пример #1
0
 public User Add(User user)
 {
     try
     {
         _userVali.CheckIfUserIsNull(user);
         User validatedUser = _userVali.ValidateUser(user);
         return(_userRep.Add(validatedUser));
     }catch (Exception ex)
     {
         throw ex;
     }
 }
        public void TestThrowsExceptionIfUserIsNull()
        {
            UserValidator userVali = new UserValidator();
            User          user     = null;
            Exception     ex       = Assert.Throws <InvalidDataException>(() =>
                                                                          userVali.CheckIfUserIsNull(user));

            Assert.Equal("Could not find user/user does not exist", ex.Message);
        }