public void Discover_returns_configuration_when_string()
        {
            var modelBuilder = new DbModelBuilder();
            modelBuilder.Entity<Entity>().Property(e => e.Name).HasMaxLength(30);
            var model = modelBuilder.Build(new DbProviderInfo("System.Data.SqlClient", "2012"));
            var entityType = model.ConceptualModel.EntityTypes.First();
            var property = entityType.Properties.First(p => p.Name == "Name");

            var configuration = new MaxLengthDiscoverer().Discover(property, model) as MaxLengthStringConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(30, configuration.MaxLength);
        }
Пример #2
0
        public void Discover_returns_configuration_when_string()
        {
            var modelBuilder = new DbModelBuilder();

            modelBuilder.Entity <Entity>().Property(e => e.Name).HasMaxLength(30);
            var model      = modelBuilder.Build(new DbProviderInfo("System.Data.SqlClient", "2012"));
            var entityType = model.ConceptualModel.EntityTypes.First();
            var property   = entityType.Properties.First(p => p.Name == "Name");

            var configuration = new MaxLengthDiscoverer().Discover(property, model) as MaxLengthStringConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(30, configuration.MaxLength);
        }