public LightweightEntityConfiguration <T> Ignore <TProperty>(Expression <Func <T, TProperty> > propertyExpression)
        {
            Check.NotNull(propertyExpression, "propertyExpression");

            _configuration.Ignore(propertyExpression.GetSimplePropertyAccess().Single());

            return(this);
        }
        public void Ignore_is_noop_when_not_exists()
        {
            var type        = new MockType();
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new LightweightEntityConfiguration(type, () => innerConfig);

            config.Ignore("Property1");

            Assert.Empty(innerConfig.IgnoredProperties);
        }
        public void Ignore_evaluates_preconditions()
        {
            var type        = new MockType();
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new LightweightEntityConfiguration(type, () => innerConfig);

            var ex = Assert.Throws <ArgumentException>(
                () => config.Ignore((string)null));

            Assert.Equal(Strings.ArgumentIsNullOrWhitespace("propertyName"), ex.Message);
        }
        public void Ignore_configures()
        {
            var type = typeof(LocalEntityType);
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration<LocalEntityType>(type, () => innerConfig);

            config.Ignore(t => t.Property1);

            Assert.Equal(1, innerConfig.IgnoredProperties.Count());
            Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1"));
        }
        public void Ignore_evaluates_preconditions()
        {
            var type = typeof(LocalEntityType);
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration<object>(type, () => innerConfig);

            var ex = Assert.Throws<ArgumentNullException>(
                () => config.Ignore<object>(null));

            Assert.Equal("propertyExpression", ex.ParamName);
        }
        public void Ignore_configures()
        {
            var type        = typeof(LocalEntityType);
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new LightweightEntityConfiguration <LocalEntityType>(type, () => innerConfig);

            config.Ignore(t => t.Property1);

            Assert.Equal(1, innerConfig.IgnoredProperties.Count());
            Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1"));
        }
        public void Ignore_evaluates_preconditions()
        {
            var type        = typeof(LocalEntityType);
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new LightweightEntityConfiguration <object>(type, () => innerConfig);

            var ex = Assert.Throws <ArgumentNullException>(
                () => config.Ignore <object>(null));

            Assert.Equal("propertyExpression", ex.ParamName);
        }
        public void Ignore_configures()
        {
            var type = new MockType()
                       .Property <int>("Property1");
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new LightweightEntityConfiguration(type, () => innerConfig);

            config.Ignore("Property1");

            Assert.Equal(1, innerConfig.IgnoredProperties.Count());
            Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1"));
        }
        public void Ignore_evaluates_preconditions()
        {
            var type = new MockType();
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration(type, () => innerConfig);

            var ex = Assert.Throws<ArgumentException>(
                () => config.Ignore((string)null));

            Assert.Equal(Strings.ArgumentIsNullOrWhitespace("propertyName"), ex.Message);
        }
        public void Ignore_is_noop_when_not_exists()
        {
            var type = new MockType();
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration(type, () => innerConfig);

            config.Ignore("Property1");

            Assert.Empty(innerConfig.IgnoredProperties);
        }
        public void Ignore_configures()
        {
            var type = new MockType()
                .Property<int>("Property1");
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration(type, () => innerConfig);

            config.Ignore("Property1");

            Assert.Equal(1, innerConfig.IgnoredProperties.Count());
            Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1"));
        }