Beispiel #1
0
 public SnapshotBuilder Snapshot(string snapshotName, SnapshotOptions snapshotOpts = SnapshotOptions.Default)
 {
     lock (_lock)
     {
         ConfigureCollection();
         var builder = _collection.NewSnapshot(snapshotName);
         if ((snapshotOpts & SnapshotOptions.NoAutoSnapshot) == 0)
         {
             DbSnapshotMaker.Make(_connectionString, builder, _schemas.Values, _collection);
         }
         _snapshotTaken = true;
         return(builder);
     }
 }
Beispiel #2
0
        public void TableContentsAreAddedToSnapshot()
        {
            //Arrange
            var collection = new SnapshotCollection();
            var schema     = SchemaStructureLoader.Load(DbController.Server, DbController.TestDbName, "Test");
            var builder    = collection.NewSnapshot("Test");

            SnapshotTableDefiner.Define(collection, schema);

            //Act
            DbSnapshotMaker.Make(DbController.ConnectionString, builder, new [] { schema }, collection);

            //Assert
            var output = new Output();

            collection.GetSnapshotReport("Test", output);
            output.Report.Verify();
        }
Beispiel #3
0
        public void CustomWhereClauseIsLoadedFromDefinition()
        {
            //Arrange
            var collection = new SnapshotCollection();
            var schema     = SchemaStructureLoader.Load(DbController.Server, DbController.TestDbName, "Test");
            var builder    = collection.NewSnapshot("Test");

            SnapshotTableDefiner.Define(collection, schema);
            var definitions = SnapshotDefinitionLoader.Load(GetType());

            collection.ApplyDefinitions(definitions);

            //Act
            DbSnapshotMaker.Make(DbController.ConnectionString, builder, new [] { schema }, collection);

            //Assert
            var output = new Output();

            collection.GetSnapshotReport("Test", output);
            output.Report.Verify();
        }
Beispiel #4
0
        public void ExcludedColumnsAreNotAddedToSnapshot()
        {
            //Arrange
            var collection = new SnapshotCollection();
            var schema     = SchemaStructureLoader.Load(DbController.Server, DbController.TestDbName, "Test");
            var builder    = collection.NewSnapshot("Test");

            SnapshotTableDefiner.Define(collection, schema);
            collection.DefineTable("[Test].[B_Related]").Exclude("Name");

            //Act
            DbSnapshotMaker.Make(DbController.ConnectionString, builder, new [] { schema }, collection);

            //Assert
            var output = new Output();

            output.WrapLine("The Name column should not be present in [Test].[B_Related] below:");
            output.WriteLine();
            collection.GetSnapshotReport("Test", output);
            output.Report.Verify();
        }