public void SsisMigrationPackage1ShouldExportAndImportData()
        {
            var sourceDatabase = default(TestDatabase);
            var destDatabase   = default(TestDatabase);
            var result         = default(bool);

            "Given a source database with one row in the products table"
            ._(() =>
            {
                sourceDatabase = _testServer.CreateNew();
                sourceDatabase.ExecuteScript("database.sql");
                var connection = Database.OpenConnection(sourceDatabase.ConnectionString);
                connection.Products.Insert(ProductCode: 1, ShippingWeight: 2f, ShippingLength: 3f,
                                           ShippingWidth: 4f, ShippingHeight: 5f, UnitCost: 6f, PerOrder: 2);
            });

            "And an empty destination database with a products table"
            ._(() =>
            {
                destDatabase = _testServer.CreateNew();
                destDatabase.ExecuteScript("database.sql");
            });

            "When I execute the migration package against the source and dest databases"
            ._(() => result = PackageRunner.Run("Package1.dtsx", new
            {
                Source_ConnectionString = sourceDatabase.ConnectionString.ToSsisCompatibleConnectionString(),
                Dest_ConnectionString   = destDatabase.ConnectionString.ToSsisCompatibleConnectionString(),
            }));

            "Then the package should execute successfully"
            ._(() => result.Should().BeTrue());

            "And the products table in the destination database should contain the row from the source database"
            ._(() => destDatabase.AssertTable().Products.ContainsExactlyOneRowMatching(
                   new {
                ProductCode    = 1,
                ShippingWeight = 2f,
                ShippingLength = 3f,
                ShippingWidth  = 4f,
                ShippingHeight = 5f,
                UnitCost       = 6f,
                PerOrder       = 2
            }
                   ));
        }
Пример #2
0
        private static void AddDomainServices(IServiceCollection services, IHostingEnvironment env)
        {
            services.AddSingleton <IStateValueManagement, StateValueManagement>();
            services.AddSingleton <ISubscribeManager, SubscribeManager>();

            var packageToRunStore = new PackageToRunStorage(_packageStorePath);

            services.AddSingleton <IPackageToRunStorage>(packageToRunStore);

            _packagesStore = new PackagesStore(_packageStorePath, new PackageToDeleteStorage(_packageStorePath), new PackageInfoDefinitionStorage());
            services.AddSingleton <IPackagesStore>(_packagesStore);

            var packageInstances = new PackagesInstances(packageToRunStore);

            services.AddSingleton <IPackagesInstances>(packageInstances);

            _packageRunner = new PackageRunner(_packageStorePath, packageInstances, new HostingConfiguration());
            services.AddSingleton <IPackageRunner>(_packageRunner);
        }
Пример #3
0
 private static void DeletePackagesMarkedToUninstallAndThenLoadInstancesToRun(PackagesStore packagesStore,
                                                                              PackageRunner packageRunner)
 {
     packagesStore.UninstallPackagesMarkedToDelete();
     packageRunner.RunAllInstancesOnServerStart();
 }