public void IsValid_ShouldBeFalse_WhenMissingMandatoryFields() { var command = new Application.Payments.Commands.CreatePayment.CreatePaymentCommand { Amount = 30, ExpirationDate = DateTime.Today, CardHolder = "test", }; var dateTimeMock = new Mock <IDateTime>(); dateTimeMock.Setup(m => m.Now) .Returns(new DateTime(3001, 1, 1)); var validator = new CreatePaymentCommandValidator(Context, dateTimeMock.Object); var result = validator.Validate(command); result.IsValid.ShouldBe(false); }
public void IsValid_ShouldBeTrue_WhenAllParametersAreCorrect() { var dateTimeMock = new Mock <IDateTime>(); dateTimeMock.Setup(m => m.Now) .Returns(new DateTime(2001, 1, 1)); var command = new Application.Payments.Commands.CreatePayment.CreatePaymentCommand { Amount = 30, SecurityCode = "123", ExpirationDate = DateTime.Today, CardHolder = "test", CreditCardNumber = "379354508162306" }; var validator = new CreatePaymentCommandValidator(Context, dateTimeMock.Object); var result = validator.Validate(command); result.IsValid.ShouldBe(true); }