Beispiel #1
0
        public void HasMaxLength_is_noop_when_not_length()
        {
            var innerConfig = new PrimitivePropertyConfiguration();
            var config      = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasMaxLength(256);

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

            var result = config.HasMaxLength(256);

            Assert.Equal(256, innerConfig.MaxLength);
            Assert.Equal(false, innerConfig.IsFixedLength);
            Assert.Same(config, result);
        }
Beispiel #3
0
        public void HasMaxLength_configures_IsUnicode_when_unset()
        {
            var innerConfig = new StringPropertyConfiguration();
            var config      = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasMaxLength(256);

            Assert.Equal(256, innerConfig.MaxLength);
            Assert.Equal(false, innerConfig.IsFixedLength);
            Assert.Equal(true, innerConfig.IsUnicode);
            Assert.Same(config, result);
        }
Beispiel #4
0
        public void HasMaxLength_is_noop_when_IsMaxLength_set()
        {
            var innerConfig = new Mock <LengthPropertyConfiguration>().Object;

            innerConfig.IsMaxLength = true;

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

            var result = config.HasMaxLength(256);

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

            var result = config.HasMaxLength(256);

            Assert.Same(config, result);
        }
        public void HasMaxLength_is_noop_when_IsMaxLength_set()
        {
            var innerConfig = new Mock<LengthPropertyConfiguration>().Object;
            innerConfig.IsMaxLength = true;

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

            var result = config.HasMaxLength(256);

            Assert.Null(innerConfig.MaxLength);
            Assert.Same(config, result);
        }
        public void HasMaxLength_does_not_configure_IsUnicode_when_set()
        {
            var innerConfig = new StringPropertyConfiguration
                                  {
                                      IsUnicode = false
                                  };
            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasMaxLength(256);

            Assert.Equal(256, innerConfig.MaxLength);
            Assert.Equal(false, innerConfig.IsFixedLength);
            Assert.Equal(false, innerConfig.IsUnicode);
            Assert.Same(config, result);
        }
        public void HasMaxLength_does_not_configure_IsFixedLenth_when_set()
        {
            var innerConfig = new Mock<LengthPropertyConfiguration>().Object;
            innerConfig.IsFixedLength = true;

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

            var result = config.HasMaxLength(256);

            Assert.Equal(256, innerConfig.MaxLength);
            Assert.Equal(true, innerConfig.IsFixedLength);
            Assert.Same(config, result);
        }