コード例 #1
0
        public void Validate_WhenCalled_ReturnsValidator()
        {
            IIdentityCommand 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_AssertShouldNotBeNullWasCalledOnObjectValidator()
        {
            IEnumerable <Claim> claims = _fixture.CreateMany <Claim>(_random.Next(5, 10)).ToList();
            IIdentityCommand    sut    = CreateSut(claims);

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

            _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldNotBeNull(
                                                                 It.Is <IEnumerable <Claim> >(value => value == claims),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.Compare(field, "Claims", false) == 0)),
                                                             Times.Once());
        }
コード例 #3
0
        public void Validate_WhenSecurityRepositoryIsNull_ThrowsArgumentNullException()
        {
            IIdentityCommand sut = CreateSut();

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

            Assert.That(result.ParamName, Is.EqualTo("securityRepository"));
        }
コード例 #4
0
        public void Validate_WhenValidatorIsNull_ThrowsArgumentNullException()
        {
            IIdentityCommand sut = CreateSut();

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

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