Exemplo n.º 1
0
        public void CanAddCategoryToCategoryForDeletedColumn()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ColumnsDroped.Add(new Column { Type = "text" });
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            report.Categories[0].Entries.Count.Should().Be(1);
            report.Categories[0].Entries[0].Categories.Count.Should().Be(1);
        }
Exemplo n.º 2
0
        public void CanAddCategoryToCategoryForChangedColumn()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ColumnsDiff.Add(new ColumnDiff(new Column { Type = "text" }, new Column { Type = "text" }, new CompareConfig()));
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            report.Categories[0].Entries.Count.Should().Be(1);
            report.Categories[0].Entries[0].Categories.Count.Should().Be(1);
        }
Exemplo n.º 3
0
        public void CanAddCategoryToCategoryForChangedConstraint()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ConstraintsChanged.Add(new Constraint("", "", "") { Table = new TableInfo("dbo", "myTable") });
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            report.Categories[0].Entries.Count.Should().Be(1);
            report.Categories[0].Entries[0].Categories.Count.Should().Be(1);
        }
Exemplo n.º 4
0
        public void CanAddCorrectEntryForDeletedTable()
        {
            var diff = new DatabaseDiff();
            diff.TablesDeleted.Add(new Table("dbo", "MyTable"));

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("MyTable");
            entry.Type.Should().Be(DiffEntryType.Deleted);
        }
Exemplo n.º 5
0
        public void CanCreateDiffReport()
        {
            var databaseDiff = new DatabaseDiff();

            var report = databaseDiff.GetDiffReport();

            report.Should().NotBeNull();
        }
Exemplo n.º 6
0
        public void CanAddCorrectEntryForDeletedConstraint()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ConstraintsDeleted.Add(new Constraint("MyConstraint", "", "") { Table = new TableInfo("dbo", "myTable") });
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries[0].Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("MyConstraint");
            entry.Type.Should().Be(DiffEntryType.Deleted);
        }
Exemplo n.º 7
0
        public void CanAddCorrectEntryForDeletedForeignKey()
        {
            var diff = new DatabaseDiff();
            diff.ForeignKeysDeleted.Add(GetForeignKey());

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("My_FK");
            entry.Type.Should().Be(DiffEntryType.Deleted);
        }
Exemplo n.º 8
0
        public void CanAddCorrectEntryForChangedRoutine()
        {
            var diff = new DatabaseDiff();
            diff.RoutinesDiff.Add(new Routine("dbo","My_Routine"));

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("My_Routine");
            entry.Type.Should().Be(DiffEntryType.Changed);
        }
Exemplo n.º 9
0
        public void CanAddCorrectEntryForDeletedColumn()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ColumnsDroped.Add(new Column { Name = "MyColumn", Type = "text" });
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries[0].Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("MyColumn");
            entry.Type.Should().Be(DiffEntryType.Deleted);
        }
Exemplo n.º 10
0
        public void CanAddCorrectEntryForChangedColumn()
        {
            var diff = new DatabaseDiff();
            var tableDiff = new TableDiff();
            tableDiff.ColumnsDiff.Add(new ColumnDiff(new Column { Name = "TargetColumn", Type = "text" }, new Column { Name = "SourceColumn", Type = "text" }, new CompareConfig()));
            diff.TablesDiff.Add(tableDiff);

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries[0].Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("SourceColumn");
            entry.Type.Should().Be(DiffEntryType.Changed);
        }
Exemplo n.º 11
0
        public void CanAddCorrectEntryForChangedProperty()
        {
            var diff = new DatabaseDiff();
            diff.PropsChanged.Add(new DbProp("prop", "value"));

            var report = diff.GetDiffReport();

            DiffEntry entry;
            (entry = report.Categories[0].Entries.FirstOrDefault()).Should().NotBeNull();
            entry.Name.Should().Be("prop");
            entry.Type.Should().Be(DiffEntryType.Changed);
        }
Exemplo n.º 12
0
        public void CanAddCategoryWithDeletedTable()
        {
            var diff = new DatabaseDiff();
            diff.TablesDeleted.Add(new Table("dbo", "MyTable"));

            var report = diff.GetDiffReport();

            report.Categories.Count.Should().Be(1);
        }
Exemplo n.º 13
0
        public void CanAddCategoryWithDeletedForeinKey()
        {
            var diff = new DatabaseDiff();
            diff.ForeignKeysDeleted.Add(GetForeignKey());

            var report = diff.GetDiffReport();

            report.Categories.Count.Should().Be(1);
        }
Exemplo n.º 14
0
        public void CanAddCategoryWithChangedTable()
        {
            var diff = new DatabaseDiff();
            diff.TablesDiff.Add(new TableDiff());

            var report = diff.GetDiffReport();

            report.Categories.Count.Should().Be(1);
        }
Exemplo n.º 15
0
        public void CanAddCategoryWithChangedRoutine()
        {
            var diff = new DatabaseDiff();
            diff.RoutinesDiff.Add(new Routine("dbo", "MySP"));

            var report = diff.GetDiffReport();

            report.Categories.Count.Should().Be(1);
        }
Exemplo n.º 16
0
        public void CanAddCategoryWithChangedProperty()
        {
            var diff = new DatabaseDiff();
            diff.PropsChanged.Add(new DbProp("prop", "value"));

            var report = diff.GetDiffReport();

            report.Categories.Count.Should().Be(1);
            report.Categories[0].Name.Should().Be("Properties");
        }