public void PinShouldFailBecauseOfSpace() { // Arrange var changePinAction = new ChangePinAction() { NewPin = "1 44", ConfirmPin = "1 44" }; var changePinValidator = new ChangePinValidator(); // Act ValidationResult validationResult = changePinValidator.Validate(changePinAction); // Assert validationResult.IsValid.ShouldBe(false); validationResult.Errors.Count.ShouldBe(1); }
public void PinShouldNotMatch() { // Arrange var changePinAction = new ChangePinAction() { NewPin = "1111", ConfirmPin = "2222" }; var changePinValidator = new ChangePinValidator(); // Act ValidationResult validationResult = changePinValidator.Validate(changePinAction); // Assert validationResult.IsValid.ShouldBe(false); validationResult.Errors.Count.ShouldBe(1); }
public void PinShouldNotBeValid() { // Arrange var changePinAction = new ChangePinAction(); var changePinValidator = new ChangePinValidator(); // Act ValidationResult validationResult = changePinValidator.Validate(changePinAction); // Assert validationResult.IsValid.ShouldBe(false); validationResult.Errors.Count.ShouldBe(1); ValidationFailure validationFailure = validationResult.Errors[0]; validationFailure.PropertyName.ShouldBe(nameof(changePinAction.NewPin)); validationFailure.Severity.ShouldBe(Severity.Error); }
public void PinShouldBeValid() { // Arrange var changePinAction = new ChangePinAction() { NewPin = "1234", ConfirmPin = "1234" }; var changePinValidator = new ChangePinValidator(); // Act ValidationResult validationResult = changePinValidator.Validate(changePinAction); // Assert validationResult.IsValid.ShouldBe(true); validationResult.Errors.Count.ShouldBe(0); }
protected async Task ChangePin() { var changePinAction = new ChangePinAction { NewPin = NewPin, ConfirmPin = ConfirmPin, EnableLogin = EnableLogin }; var validator = new ChangePinValidator(); ValidationResult = validator.Validate(changePinAction); if (ValidationResult.IsValid) { await Mediator.Send(changePinAction); // Upon successful resolve of the above function pop the modal here // @showModal = true Console.WriteLine("Change the Route to the Home Page."); await Mediator.Send(new ChangeRouteAction { NewRoute = HomeBase.Route }); } }