public void ShouldBeGreaterThanOrEqualToZero_WhenValueIsEqualToZero_ReturnsDecimalValidator() { IDecimalValidator sut = CreateSut(); IValidator result = sut.ShouldBeGreaterThanOrEqualToZero(0M, GetType(), _fixture.Create <string>()); Assert.That(result, Is.TypeOf <BusinessLogic.Validation.DecimalValidator>()); }
public void ShouldBeGreaterThanOrEqualToZero_WhenValueIsLowerThanZero_ThrowsIntranetValidationException() { IDecimalValidator sut = CreateSut(); Type validatingType = GetType(); string validatingField = _fixture.Create <string>(); IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.ShouldBeGreaterThanOrEqualToZero(_random.Next(1, 5) * -1, validatingType, validatingField)); Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueNotGreaterThanOrEqualToZero)); Assert.That(result.ValidatingType, Is.EqualTo(validatingType)); Assert.That(result.ValidatingField, Is.EqualTo(validatingField)); }
public void ShouldBeGreaterThanOrEqualToZero_WhenValidatingFieldIsWhiteSpace_ThrowsArgumentNullException() { IDecimalValidator sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldBeGreaterThanOrEqualToZero(_fixture.Create <int>(), GetType(), " ")); Assert.That(result.ParamName, Is.EqualTo("validatingField")); }
public void ShouldBeGreaterThanOrEqualToZero_WhenValidatingTypeIsNull_ThrowsArgumentNullException() { IDecimalValidator sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldBeGreaterThanOrEqualToZero(_fixture.Create <int>(), null, _fixture.Create <string>())); Assert.That(result.ParamName, Is.EqualTo("validatingType")); }