public void Validate(User user) { if (user.Username == "") { throw new ValidationException("Invalid username!"); } }
public void ValidateTest1() { User user = new User(""); try { validator.Validate(user); Assert.AreEqual(1, 2); } catch (Exception) { Assert.AreEqual(1, 1); } user.Username = "******"; try { validator.Validate(user); Assert.AreEqual(1, 1); } catch (Exception) { Assert.AreEqual(1, 2); } }
public void UserTest() { User user = new User("username"); //testing constructor Assert.AreEqual("username", user.Username); //testing get and set id user.Id = 1; Assert.AreEqual(1, user.Id); //testing get and set username user.Username = "******"; Assert.AreEqual("test", user.Username); }
public void Save(User user) { _userGenericRepository.Save(user); }