public void Validate_WhenCalled_AssertShouldBeBetweenWasCalledOnIntegerValidator() { int accountingNumber = _fixture.Create <int>(); IAccountingIdentificationQuery sut = CreateSut(accountingNumber); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.IntegerValidatorMock.Verify(m => m.ShouldBeBetween( It.Is <int>(value => value == accountingNumber), It.Is <int>(minValue => minValue == 1), It.Is <int>(maxValue => maxValue == 99), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.Compare(field, "AccountingNumber", false) == 0)), Times.Once()); }
public void Validate_WhenCalled_AssertShouldBePastDateOrTodayWasCalledOnDateTimeValidator() { DateTime statusDate = _fixture.Create <DateTime>(); IAccountingIdentificationQuery sut = CreateSut(statusDate: statusDate); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.DateTimeValidatorMock.Verify(m => m.ShouldBePastDateOrToday( It.Is <DateTime>(value => value == statusDate.Date), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.Compare(field, "StatusDate", false) == 0)), Times.Once()); }
public void Validate_WhenCalled_AssertShouldBeKnownValueWasCalledOnObjectValidatorWithAccountingNumber() { int accountingNumber = _fixture.Create <int>(); IAccountingIdentificationQuery sut = CreateSut(accountingNumber); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeKnownValue( It.Is <int>(value => value == accountingNumber), It.IsNotNull <Func <int, Task <bool> > >(), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.CompareOrdinal(field, "AccountingNumber") == 0), It.Is <bool>(allowNull => allowNull == false)), Times.Once); }