Ejemplo n.º 1
0
        public void FullImportAdventureWorksDatabase()
        {
            // Arrange
            var logger = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();

            // todo: add mapping for custom types
            var databaseFactory = new SqlServerDatabaseFactory(logger)
            {
                ConnectionString = "server=(local);database=AdventureWorks2017;integrated security=yes;MultipleActiveResultSets=true;",
                ImportSettings   = new DatabaseImportSettings
                {
                    ImportStoredProcedures = true,
                    ImportTableFunctions   = true,
                    ImportScalarFunctions  = true,
                    ExclusionTypes         = new List <string> {
                        "geography"
                    }
                }
            };

            // Act
            var database = databaseFactory.Import();

            // Assert
            foreach (var table in database.Tables)
            {
                Assert.False(table.Columns.Contains(new Column {
                    Name = "SpatialLocation"
                }));
            }

            Assert.True(database.TableFunctions.FirstOrDefault(item => item.FullName == "dbo.ufnGetContactInformation").Parameters.Count == 1);
        }
Ejemplo n.º 2
0
        public void ImportAdventureWorksDatabase()
        {
            // Arrange
            var logger = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();

            // todo: add mapping for custom types
            var databaseFactory = new SqlServerDatabaseFactory(logger)
            {
                ConnectionString = "server=(local);database=AdventureWorks2017;integrated security=yes;",
                ImportSettings   = new DatabaseImportSettings
                {
                    ExclusionTypes = new List <string> {
                        "geography"
                    }
                }
            };

            // Act
            var database = databaseFactory.Import();

            // Assert
            foreach (var table in database.Tables)
            {
                Assert.False(table.Columns.Contains(new Column {
                    Name = "SpatialLocation"
                }));
            }
        }
Ejemplo n.º 3
0
        public void ImportStoreDatabaseTest()
        {
            // Arrange
            var logger = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();

            // Act
            var database = SqlServerDatabaseFactory
                           .Import(logger, "server=(local);database=Store;integrated security=yes;");

            // Assert
            Assert.True(database.Tables.Count > 0);
        }
Ejemplo n.º 4
0
        public void ImportNorthwindDatabaseTest()
        {
            // Arrange
            var logger = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();

            // Act
            var database = SqlServerDatabaseFactory
                           .Import(logger, "server=(local);database=Northwind;integrated security=yes;", "dbo.ChangeLog");

            // Assert
            Assert.True(database.Tables.Count > 0);
            Assert.True(database.FindTable("dbo.ChangeLog") == null);
        }
Ejemplo n.º 5
0
        public void ImportWithLoggerStoreTablesTest()
        {
            // Arrange
            var logger = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();

            // Act
            var database = SqlServerDatabaseFactory
                           .ImportTables(logger, "server=(local);database=Store;integrated security=yes;", "Sales.Order", "Sales.OrderDetail");

            // Assert
            Assert.True(database.Tables.Count == 2);
            Assert.True(database.Views.Count == 0);
        }
Ejemplo n.º 6
0
        public void FullImportNorthwindDatabaseTest()
        {
            // Arrange
            var logger          = LoggerMocker.GetLogger <SqlServerDatabaseFactory>();
            var databaseFactory = new SqlServerDatabaseFactory(logger)
            {
                ConnectionString = "server=(local);database=Northwind;integrated security=yes;MultipleActiveResultSets=true;",
                ImportSettings   = new DatabaseImportSettings
                {
                    ImportStoredProcedures = true,
                    ImportTableFunctions   = true,
                    ImportScalarFunctions  = true
                }
            };

            // Act
            var database = databaseFactory.Import();

            // Assert
            Assert.True(database.Tables.Count > 0);
            Assert.True(database.Views.Count > 0);
            Assert.True(database.StoredProcedures.Count > 0);
        }