public void DefinitionsAreLoadedFromEnclosingType() { //Act var definition = SnapshotDefinitionLoader.Load(GetType()); //Assert var output = new Output(); TableDefinitionReporter.Report(definition.Tables, output); output.Report.Verify(); }
public void DefinitionsAreLoadedFromAssembly() { //Arrange var definition = SnapshotDefinitionLoader.Load(GetType(), t => t.Name.StartsWith("A_")); //Act var loaded = DefinitionSetMerger.Merge(definition, null).ToList(); //Assert var output = new Output(); TableDefinitionReporter.Report(loaded, output); output.Report.Verify(); }
public void DefinitionsAreFilteredWhenLoadedFromEnclosingType() { //Arrange var assembly = GetType().Assembly; //Act var definition = SnapshotDefinitionLoader.Load(GetType(), t => t != typeof(TableDef)); //Assert var output = new Output(); TableDefinitionReporter.Report(definition.Tables, output); output.Report.Verify(); }
public void DefinitionsAreLoadedFromAssembly() { //Arrange var assembly = GetType().Assembly; //Act var definition = SnapshotDefinitionLoader.Load(assembly); //Assert var output = new Output(); TableDefinitionReporter.Report(definition.Tables, output); output.Report.Verify(); }
public void GetSchemaReport(Output output, bool verbose = false) { if (verbose) { TableDefinitionReporter.Report(TablesInDefinitionOrder, output); } else { var report = _tableDefinitions.Values.AsReport(rep => rep .AddColumn(t => t.TableName) .AddColumn(t => string.Join((string)" + ", (IEnumerable <string>)t.PrimaryKeys), cc => cc.Heading("Primary Key")) .AddColumn(t => string.Join((string)" + ", (IEnumerable <string>)t.CompareKeys), cc => cc.Heading("Compare Key")) .Title("Tables Defined") ); output.FormatTable(report); } }
public void ReferencesAreMerged() { //Arrange var left = new TableDefinition(Table); var right = new TableDefinition(Table); left.SetReference("RefB", "B", "BKey"); left.SetReference("RefD", "D", "DKey"); right.SetReference("RefC", "C", "CKey"); right.SetReference("RefD", "D", "DKey"); //Act var result = TableDefinitionMerger.Merge(left, right); //Assert var output = new Output(); TableDefinitionReporter.Report(result, output); output.Report.Verify(); }