コード例 #1
0
        public void Validate_WhenCalled_AssertShouldBeKnownValueWasCalledOnObjectValidatorForExternalIdentifier()
        {
            string externalIdentifier = _fixture.Create <string>();
            IUpdateContactCommand sut = CreateSut(externalIdentifier);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object);

            _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeKnownValue(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, externalIdentifier) == 0),
                                                                 It.IsNotNull <Func <string, Task <bool> > >(),
                                                                 It.Is <Type>(value => value == sut.GetType()),
                                                                 It.Is <string>(value => string.CompareOrdinal(value, "ExternalIdentifier") == 0),
                                                                 It.Is <bool>(value => value == false)),
                                                             Times.Once);
        }
コード例 #2
0
        public void Validate_WhenCalled_AssertShouldNotBeNullOrWhiteSpaceWasCalledOnStringValidatorForExternalIdentifier()
        {
            string externalIdentifier = _fixture.Create <string>();
            IUpdateContactCommand sut = CreateSut(externalIdentifier);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _microsoftGraphRepositoryMock.Object, _contactRepositoryMock.Object, _accountingRepositoryMock.Object);

            _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldNotBeNullOrWhiteSpace(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, externalIdentifier) == 0),
                                                                 It.Is <Type>(value => value == sut.GetType()),
                                                                 It.Is <string>(value => string.CompareOrdinal(value, "ExternalIdentifier") == 0)),
                                                             Times.Once);
        }