public void WhenTablePrimaryKeyChanged() { //arrange var sb = new List <CompareResult>(); var writer = new ComparisonWriter(SqlType.SqlServer); var target = new CompareTables(sb, writer); var baseTables = new List <DatabaseTable> { CreateTable() }; var table = CreateTable().AddColumn("D", DbType.Int32).Table; table.PrimaryKey.Columns.Clear(); table.PrimaryKey.Columns.Add("D");//the primary key is D, not A var compareTables = new List <DatabaseTable> { table }; //act target.Execute(baseTables, compareTables); var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray()); //assert Assert.IsTrue(result.Contains("ALTER TABLE [Test] ADD [D] INT"), "add the new column"); Assert.IsTrue(result.Contains("ALTER TABLE [Test] DROP CONSTRAINT [PK_TEST]"), "drop the old pk"); Assert.IsTrue(result.Contains("ALTER TABLE [Test] ADD CONSTRAINT [PK_TEST] PRIMARY KEY ([D])"), "add the new pk"); }
public void WhenTableUniqueConstraintChanged() { //arrange var sb = new List <CompareResult>(); var writer = new ComparisonWriter(SqlType.SqlServer); var target = new CompareTables(sb, writer); var baseTable = CreateTable(); baseTable.FindColumn("B").AddUniqueKey("UK_TEST"); var baseTables = new List <DatabaseTable> { baseTable }; var compareTable = CreateTable().AddColumn("D", DbType.Int32).Table; compareTable.FindColumn("D").AddUniqueKey("UK_TEST"); var compareTables = new List <DatabaseTable> { compareTable }; //act target.Execute(baseTables, compareTables); var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray()); //assert Assert.IsTrue(result.Contains("ALTER TABLE [Test] ADD [D] INT"), "add the new column"); Assert.IsTrue(result.Contains("ALTER TABLE [Test] DROP CONSTRAINT [UK_TEST]"), "drop the old unique key"); Assert.IsTrue(result.Contains("ALTER TABLE [Test] ADD CONSTRAINT [UK_TEST] UNIQUE ([D])"), "add the new unique key"); }
private static void Main(string[] args) { //Documents CompareDocumentsWithTables.WithTablesOnAppropriatePages(); CompareDocumentsWithTables.WithTablesOnDefferentPages(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumnsAndDifferentCountOfRows(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfRows(); CompareDocumentsWithText.WithTextOnAppropriatePages(); CompareDocumentsWithText.WithTextOnDifferentPages(); CompareDocumentsWithHyperlinks.WithIgnoreLinkSetting(); CompareDocumentsWithHyperlinks.WithoutIgnoreLinkSetting(); //Settings ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetChars(); ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetWords(); ComparisonWithDifferentSettings.CompareDocumentsWithGenerationSummaryPage(); ComparisonWithDifferentSettings.CompareDocumentsWithOutGenerationSummaryPage(); ComparisonWithDifferentSettings.CompareDocumentsWithOutShowDeletedContent(); ComparisonWithDifferentSettings.CompareDocumentsWithShowDeletedContent(); ComparisonWithDifferentSettings.CompareDocumentsWithWordsSepCharsSetSpace(); ComparisonWithDifferentSettings.CompareDocumentsWithSettingStylesOnDelInsComponents(); //Components CompareParagraphs.CompareParagraphsFromDifferentDocuments(); CompareParagraphs.CompareParagraphFromDocumentWithCreatingParagraph(); CompareParagraphs.CompareTwoCreatingParagraphs(); CompareRows.CompareRowsFromDifferentDocuments(); CompareRows.CompareRowFromDocumentWithCreatingRow(); CompareRows.CompareTwoCreatingRows(); CompareColumns.CompareColumnFromDocumentWithCreatingColumn(); CompareColumns.CompareColumnsFromDifferentDocuments(); CompareColumns.CompareTwoCreatingColumns(); CompareCells.CompareCellFromDocumentWithCreatingCell(); CompareCells.CompareCellsFromDifferentDocuments(); CompareCells.CompareTwoCreatingCells(); CompareTables.CompareTableFromDocumentWithCreatingTable(); CompareTables.CompareTablesFromDifferentDocuments(); CompareTables.CompareTwoCreatingTables(); //Console.ReadKey(); }
public void WhenTablesIdentical() { //arrange var sb = new List <CompareResult>(); var writer = new ComparisonWriter(SqlType.SqlServer); var target = new CompareTables(sb, writer); var baseTables = new List <DatabaseTable> { CreateTable() }; var compareTables = new List <DatabaseTable> { CreateTable() }; //act target.Execute(baseTables, compareTables); var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray()); //assert Assert.IsTrue(string.IsNullOrEmpty(result)); }
private static void Main(string[] args) { //Components CompareSlides.CompareSlidesFromDifferentPresentations(); CompareSlides.CompareSlidesFromOnePresentations(); CompareSlides.CompareSlideFromPresentationsWithCreatingSlide(); CompareSlides.CompareTwoCreatingSlides(); CompareCells.CompareCellsFromDifferentPresentations(); CompareCells.CompareCellsFromOnePresentations(); CompareCells.CompareCellFromPresentationsWithCreatingCell(); CompareCells.CompareTwoCreatingCells(); CompareParagraphs.CompareParagraphFromPresentationsWithCreatingParagraph(); CompareParagraphs.CompareParagraphsFromDifferentPresentations(); CompareParagraphs.CompareParagraphsFromOnePresentations(); CompareParagraphs.CompareTwoCreatingParagraphs(); CompareAutoShapes.CompareAutoShapeFromPresentationsWithCreatingAutoShape(); CompareAutoShapes.CompareAutoShapesFromDifferentPresentations(); CompareAutoShapes.CompareAutoShapesFromOnePresentations(); CompareAutoShapes.CompareTwoCreatingAutoShapes(); CompareTables.CompareTableFromPresentationsWithCreatingTable(); CompareTables.CompareTablesFromDifferentPresentations(); CompareTables.CompareTablesFromOnePresentations(); CompareTables.CompareTwoCreatingTables(); CompareRows.CompareRowFromPresentationsWithCreatingRow(); CompareRows.CompareRowsFromDifferentPresentations(); CompareRows.CompareRowsFromOnePresentations(); CompareRows.CompareTwoCreatingRows(); CompareColumns.CompareColumnFromPresentationsWithCreatingColumn(); CompareColumns.CompareColumnsFromDifferentPresentations(); CompareColumns.CompareColumnsFromOnePresentations(); CompareColumns.CompareTwoCreatingColumns(); // Presentations ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnAppropriateSlides(); ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnDifferentSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesOnAppropriateSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesOnDifferentSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfRows(); ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumns(); ComparePresentationsWithTables .ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumnsAndDifferentCountOfRows(); //Settings ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetChars(); ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetWords(); ComparisonWithDifferentSettings.ComparePresentationsWithGenerationSummaryPage(); ComparisonWithDifferentSettings.ComparePresentationsWithOutGenerationSummaryPage(); ComparisonWithDifferentSettings.ComparePresentationsWithOutShowDeletedContent(); ComparisonWithDifferentSettings.ComparePresentationsWithShowDeletedContent(); ComparisonWithDifferentSettings.ComparePresentationsWithWordsSepCharsSetSpace(); ComparisonWithDifferentSettings.ComparePresentationsWithSettingStylesOnDelInsComponents(); //Console.ReadKey(); }