コード例 #1
0
        public void Validate_WhenCalled_ReturnsValidator()
        {
            IDeleteUserIdentityCommand sut = CreateSut();

            IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _securityRepositoryMock.Object);

            Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object));
        }
コード例 #2
0
        public void Validate_WhenCalled_AssertShouldBeKnownValueWasCalledOnObjectValidator()
        {
            int identifier = _fixture.Create <int>();
            IDeleteUserIdentityCommand sut = CreateSut(identifier);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _securityRepositoryMock.Object);

            _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeKnownValue(
                                                                 It.Is <int>(value => value == identifier), It.IsNotNull <Func <int, Task <bool> > >(),
                                                                 It.Is <Type>(value => sut.GetType() == value),
                                                                 It.Is <string>(value => string.Compare(value, "Identifier", StringComparison.Ordinal) == 0),
                                                                 It.Is <bool>(value => value == false)),
                                                             Times.Once());
        }
コード例 #3
0
        public void Validate_WhenSecurityRepositoryIsNull_ThrowsArgumentNullException()
        {
            IDeleteUserIdentityCommand sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null));

            Assert.That(result.ParamName, Is.EqualTo("securityRepository"));
        }