Beispiel #1
0
 public void TestInitialize()
 {
     testClass = new MinLengthTest()
     {
         CorrectValue   = "12345",
         IncorrectValue = "12345"
     };
 }
        public void Int64UnderMinValueWillFail()
        {
            var instance = new MinLengthTest { Value = 1 };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because an integer range attribute applies to an Int64 property");
            result.IsSuccess.Should().BeFalse("because the Int64 value is less than the minimum value");
        }
        public void StringUnderMinLengthWillFail()
        {
            var instance = new MinLengthTest { Value = "a" };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because a string length attribute applies to a string property");
            result.IsSuccess.Should().BeFalse("because the string is less than the minimum length");
        }
Beispiel #4
0
        public void StringUnderMinLengthWillFail()
        {
            var instance = new MinLengthTest {
                Value = "a"
            };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because a string length attribute applies to a string property");
            result.IsSuccess.Should().BeFalse("because the string is less than the minimum length");
        }
Beispiel #5
0
        public void StringWithinMinimumAndMaximumRangeWillSucceed()
        {
            var instance = new MinLengthTest {
                Value = "aaaa"
            };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because a string length attribute applies to a string property");
            result.IsSuccess.Should().BeTrue("because the string is within the min/max bounds");
        }
        public void Int64UnderMinValueWillFail()
        {
            var instance = new MinLengthTest {
                Value = 1
            };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because an integer range attribute applies to an Int64 property");
            result.IsSuccess.Should().BeFalse("because the Int64 value is less than the minimum value");
        }
        public void StringWithinMinimumAndMaximumRangeWillSucceed()
        {
            var instance = new MinLengthTest { Value = "aaaa" };
            var result = this.provider.Validate(instance);

            result.Should().NotBeNull("because we should always get a result");
            result.IsApplicable.Should().BeTrue("because a string length attribute applies to a string property");
            result.IsSuccess.Should().BeTrue("because the string is within the min/max bounds");
        }