public void Validate_WhenCalled_AssertShouldBeKnownValueWasCalledOnObjectValidatorWithAccountingNumber() { int accountingNumber = _fixture.Create <int>(); IApplyPostingJournalCommand sut = CreateSut(accountingNumber); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object, _commonRepositoryMock.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); }
public void Validate_WhenCalled_AssertShouldContainItemsWasCalledOnEnumerableValidatorWithPostingLineCollection() { IEnumerable <IApplyPostingLineCommand> applyPostingLineCommandCollection = _fixture.CreateMany <IApplyPostingLineCommand>(_random.Next(10, 25)).ToArray(); IApplyPostingJournalCommand sut = CreateSut(applyPostingLineCommandCollection: applyPostingLineCommandCollection); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object, _commonRepositoryMock.Object); _validatorMockContext.EnumerableValidatorMock.Verify(m => m.ShouldContainItems( It.Is <IEnumerable <IApplyPostingLineCommand> >(value => value.Equals(applyPostingLineCommandCollection)), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.CompareOrdinal(field, "PostingLineCollection") == 0), It.Is <bool>(value => value == false)), Times.Once); }