Exemple #1
0
        public void ShouldNotBeNull_WhenValueIsNotNull_ReturnsObjectValidator()
        {
            IObjectValidator sut = CreateSut();

            IValidator result = sut.ShouldNotBeNull(_fixture.Create <object>(), GetType(), _fixture.Create <string>());

            Assert.That(result, Is.TypeOf <BusinessLogic.Validation.ObjectValidator>());
        }
Exemple #2
0
        public void ShouldNotBeNull_WhenValidatingFieldIsWhiteSpace_ThrowsArgumentNullException()
        {
            IObjectValidator sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldNotBeNull(_fixture.Create <object>(), GetType(), " "));

            Assert.That(result.ParamName, Is.EqualTo("validatingField"));
        }
Exemple #3
0
        public void ShouldNotBeNull_WhenValueIsNull_ThrowsIntranetValidationException()
        {
            IObjectValidator sut = CreateSut();

            Type   validatingType              = GetType();
            string validatingField             = _fixture.Create <string>();
            IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.ShouldNotBeNull <object>(null, validatingType, validatingField));

            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueCannotBeNull));
            Assert.That(result.ValidatingType, Is.EqualTo(validatingType));
            Assert.That(result.ValidatingField, Is.EqualTo(validatingField));
        }
Exemple #4
0
        public void ShouldNotBeNull_WhenValidatingTypeIsNull_ThrowsArgumentNullException()
        {
            IObjectValidator sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldNotBeNull(_fixture.Create <object>(), null, _fixture.Create <string>()));

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