예제 #1
0
        public void update_is_second_in_priority()
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));
            var table2 = new Table(new DbObjectName("public", "sometable2"));
            var table3 = new Table(new DbObjectName("public", "sometable3"));
            var table4 = new Table(new DbObjectName("public", "sometable4"));

            //patch.Log(table1, SchemaPatchDifference.Invalid);
            patch.Log(table2, SchemaPatchDifference.Create);
            patch.Log(table3, SchemaPatchDifference.None);
            patch.Log(table4, SchemaPatchDifference.Update);

            patch.Difference.ShouldBe(SchemaPatchDifference.Update);
        }
예제 #2
0
        public void invalid_wins_over_all_else()
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));
            var table2 = new Table(new DbObjectName("public", "sometable2"));
            var table3 = new Table(new DbObjectName("public", "sometable3"));
            var table4 = new Table(new DbObjectName("public", "sometable4"));

            patch.Log(table1, SchemaPatchDifference.Invalid);
            patch.Log(table2, SchemaPatchDifference.Create);
            patch.Log(table3, SchemaPatchDifference.None);
            patch.Log(table4, SchemaPatchDifference.Update);

            patch.Difference.ShouldBe(SchemaPatchDifference.Invalid);
        }
예제 #3
0
        public void return_none_if_no_changes_detected()
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));
            var table2 = new Table(new DbObjectName("public", "sometable2"));
            var table3 = new Table(new DbObjectName("public", "sometable3"));
            var table4 = new Table(new DbObjectName("public", "sometable4"));

            patch.Log(table1, SchemaPatchDifference.None);
            patch.Log(table2, SchemaPatchDifference.None);
            patch.Log(table3, SchemaPatchDifference.None);
            patch.Log(table4, SchemaPatchDifference.None);

            patch.Difference.ShouldBe(SchemaPatchDifference.None);
        }
예제 #4
0
        public void create_takes_precedence_over_none()
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));
            var table2 = new Table(new DbObjectName("public", "sometable2"));
            var table3 = new Table(new DbObjectName("public", "sometable3"));
            var table4 = new Table(new DbObjectName("public", "sometable4"));

            //patch.Log(table1, SchemaPatchDifference.Invalid);
            patch.Log(table2, SchemaPatchDifference.Create);
            patch.Log(table3, SchemaPatchDifference.None);
            //patch.Log(table4, SchemaPatchDifference.Update);

            patch.Difference.ShouldBe(SchemaPatchDifference.Create);
        }
예제 #5
0
        public void should_not_throw_exception_on_assertion(SchemaPatchDifference difference, AutoCreate autoCreate)
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));

            patch.Log(table1, difference);

            patch.AssertPatchingIsValid(autoCreate);
        }
예제 #6
0
        public void should_throw_exception_on_assertion(SchemaPatchDifference difference, AutoCreate autoCreate)
        {
            var patch  = new SchemaPatch(new DdlRules());
            var table1 = new Table(new DbObjectName("public", "sometable1"));

            patch.Log(table1, difference);

            Exception <InvalidOperationException> .ShouldBeThrownBy(() =>
            {
                patch.AssertPatchingIsValid(autoCreate);
            });
        }