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

            var configuration = new PrecisionDecimalDiscoverer()
                .Discover(property, model) as PrecisionDecimalConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(9, configuration.Precision);
            Assert.Equal(0, configuration.Scale);
        }
Beispiel #2
0
        public void Discover_returns_configuration()
        {
            var modelBuilder = new DbModelBuilder();

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

            var configuration = new PrecisionDecimalDiscoverer()
                                .Discover(property, model) as PrecisionDecimalConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(9, configuration.Precision);
            Assert.Equal(0, configuration.Scale);
        }