예제 #1
0
        public void IsMaxLength_is_noop_when_not_length()
        {
            var innerConfig = new PrimitivePropertyConfiguration();
            var config      = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Same(config, result);
        }
예제 #2
0
        public void IsMaxLength_configures_when_unset()
        {
            var innerConfig = new Mock <LengthPropertyConfiguration>().Object;
            var config      = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Equal(true, innerConfig.IsMaxLength);
            Assert.Same(config, result);
        }
예제 #3
0
        public void IsMaxLength_is_noop_when_MaxLength_set()
        {
            var innerConfig = new Mock <LengthPropertyConfiguration>().Object;

            innerConfig.MaxLength = 256;

            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Null(innerConfig.IsMaxLength);
            Assert.Same(config, result);
        }
        public void IsMaxLength_is_noop_when_not_length()
        {
            var innerConfig = new PrimitivePropertyConfiguration();
            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Same(config, result);
        }
        public void IsMaxLength_is_noop_when_MaxLength_set()
        {
            var innerConfig = new Mock<LengthPropertyConfiguration>().Object;
            innerConfig.MaxLength = 256;

            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Null(innerConfig.IsMaxLength);
            Assert.Same(config, result);
        }
        public void IsMaxLength_configures_when_unset()
        {
            var innerConfig = new Mock<LengthPropertyConfiguration>().Object;
            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.IsMaxLength();

            Assert.Equal(true, innerConfig.IsMaxLength);
            Assert.Same(config, result);
        }