private void ApplyConfig() { foreach (var schema in _schemas.Values) { SnapshotTableDefiner.Define(_collection, schema); } foreach (var definitionSet in _overrides) { _collection.ApplyDefinitions(definitionSet); } }
public void BasicTableStructureIsLoaded() { //Arrange var collection = new SnapshotCollection(); //Act SnapshotTableDefiner.Define(collection, _schema); //Assert var output = new Output(); collection.GetSchemaReport(output, true); output.Report.Verify(); }
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(); }
public void ExcludedColumnsAreNotGenerated() { //Arrange var collection = new SnapshotCollection(); var schema = SchemaStructureLoader.Load(DbController.Server, DbController.TestDbName, "Test"); SnapshotTableDefiner.Define(collection, schema); var definitions = SnapshotDefinitionLoader.Load(GetType()); collection.ApplyDefinitions(definitions); var table = schema.Tables.Single(t => t.Name == "[Test].[B_Related]"); //Act var select = SnapshotTableSelectBuilder.Build(table, collection.GetTableDefinition(table.Name)); //Assert select.Should().Be("SELECT * FROM [Test].[B_Related] WHERE [Name] LIKE 'First%'"); }
public void BasicSelectIsBuilt() { //Arrange var collection = new SnapshotCollection(); var schema = SchemaStructureLoader.Load(DbController.Server, DbController.TestDbName, "Test"); SnapshotTableDefiner.Define(collection, schema); var definitions = SnapshotDefinitionLoader.Load(GetType()); collection.ApplyDefinitions(definitions); var table = schema.Tables.First(); //Act var select = SnapshotTableSelectBuilder.Build(table, collection.GetTableDefinition(table.Name)); //Assert select.Should().Be("SELECT * FROM [Test].[A_Main]"); }
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(); }
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(); }