Beispiel #1
0
        public void Validate_WhenCalled_ReturnsValidator()
        {
            IGetKeyQuery sut = CreateSut();

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

            Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object));
        }
Beispiel #2
0
        public void Validate_WhenCalled_AssertShouldNotBeNullWasCalledOnObjectValidatorWithKeyElementCollection()
        {
            IEnumerable <string> keyElementCollection = _fixture.CreateMany <string>(_random.Next(1, 5)).ToArray();
            IGetKeyQuery         sut = CreateSut(keyElementCollection);

            sut.Validate(_validatorMockContext.ValidatorMock.Object);

            _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldNotBeNull(
                                                                 It.Is <IEnumerable <string> >(value => value != null && value.Equals(keyElementCollection)),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.CompareOrdinal(field, "KeyElementCollection") == 0)),
                                                             Times.Once());
        }
Beispiel #3
0
        public void Validate_WhenValidatorIsNull_ThrowsArgumentNullException()
        {
            IGetKeyQuery sut = CreateSut();

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

            // ReSharper disable PossibleNullReferenceException
            Assert.That(result.ParamName, Is.EqualTo("validator"));
            // ReSharper restore PossibleNullReferenceException
        }