public void TestLoginInteractorValidation_WithEmptyPassword_ShouldRespondFailWithPasswordError() { var request = new LoginMessages.Request() { Username = "******", Password = null }; var response = Sut.Handle(request); Assert.IsFalse(response.Success, "Should have failed!"); Assert.AreEqual(response.Exception.Message, LoginValidationException.ValidationMessageFor(LoginValidationExceptions.InvalidPassword), "Unexpected message!"); }
public void TestLogin_WithInvalidUsernameRequest_ShouldThrowValidationError() { var request = new LoginMessages.Request() { Username = "", Password = "******" }; try { Validator.Validate(request); Assert.Fail("Should have thrown an exception!"); } catch (LoginValidationException ex) { Assert.AreEqual(ex.Message, LoginValidationException.ValidationMessageFor(LoginValidationExceptions.InvalidUsername)); } }