public void Validate_GoodUser_ShouldPass() { // Arrange var loginDTO = DummyData.LoginDTOFaker.Generate(); // Act var result = _sut.TestValidate(loginDTO); // Assert result.ShouldNotHaveAnyValidationErrors(); }
public void ShouldHaveErrorWhenEmailIsNullOrEmpty() { var model = new LoginModel { Email = null }; _validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.Email); model.Email = string.Empty; _validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.Email); }
public void ShouldNotHaveErrorWhenEmailIsNullButUsernamesAreEnabled() { var customerSettings = new CustomerSettings { UsernamesEnabled = true }; _validator = new LoginValidator(GetService <ILocalizationService>(), customerSettings); var model = new LoginModel { Email = null }; _validator.TestValidate(model).ShouldNotHaveValidationErrorFor(x => x.Email); }