コード例 #1
0
        public void StringAboveMaxLengthWillFail()
        {
            var instance = new MaxLengthTest { Value = "aaaaa" };
            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 greater than the maximum length");
        }
コード例 #2
0
        public void Int64AboveMaxValueWillFail()
        {
            var instance = new MaxLengthTest { Value = 5 };
            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 greater than the maximum value");
        }             
コード例 #3
0
        public void StringAboveMaxLengthWillFail()
        {
            var instance = new MaxLengthTest {
                Value = "aaaaa"
            };
            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 greater than the maximum length");
        }
コード例 #4
0
        public void Int64AboveMaxValueWillFail()
        {
            var instance = new MaxLengthTest {
                Value = 5
            };
            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 greater than the maximum value");
        }