public void WheProcedureChanged()
        {
            //arrange
            var sb     = new List <CompareResult>();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };
            var          sproc       = CreateProcedure();
            const string orderByName = " ORDER BY NAME";

            sproc.Sql += orderByName;
            var compareProcedures = new List <DatabaseStoredProcedure> {
                sproc
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray());

            //assert
            Assert.IsTrue(result.Contains("DROP PROCEDURE"));
            Assert.IsTrue(result.Contains("CREATE PROCEDURE"));
            Assert.IsTrue(result.Contains(orderByName));
        }
Exemple #2
0
        public void WheProcedureChanged()
        {
            //arrange
            var sb     = new StringBuilder();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };
            var          sproc       = CreateProcedure();
            const string orderByName = " ORDER BY NAME";

            sproc.Sql += orderByName;
            var compareProcedures = new List <DatabaseStoredProcedure> {
                sproc
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = sb.ToString();

            //assert
            Assert.IsTrue(result.Contains("DROP PROCEDURE"));
            Assert.IsTrue(result.Contains("CREATE PROCEDURE"));
            Assert.IsTrue(result.Contains(orderByName));
        }
        public void WhenProcedureAdded()
        {
            //arrange
            var sb     = new List <CompareResult>();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures    = new List <DatabaseStoredProcedure>();
            var compareProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray());

            //assert
            Assert.IsTrue(result.Contains("CREATE PROCEDURE"));
        }
Exemple #4
0
        public void WhenProcedureAdded()
        {
            //arrange
            var sb     = new StringBuilder();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures    = new List <DatabaseStoredProcedure>();
            var compareProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = sb.ToString();

            //assert
            Assert.IsTrue(result.Contains("CREATE PROCEDURE"));
        }
        public void WhenProceduresIdentical()
        {
            //arrange
            var sb     = new List <CompareResult>();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };
            var compareProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = string.Join(Environment.NewLine, sb.Select(x => x.Script).ToArray());

            //assert
            Assert.IsTrue(string.IsNullOrEmpty(result));
        }
Exemple #6
0
        public void WhenProceduresIdentical()
        {
            //arrange
            var sb     = new StringBuilder();
            var writer = new ComparisonWriter(SqlType.SqlServer);
            var target = new CompareProcedures(sb, writer);

            var baseProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };
            var compareProcedures = new List <DatabaseStoredProcedure> {
                CreateProcedure()
            };

            //act
            target.Execute(baseProcedures, compareProcedures);
            var result = sb.ToString();

            //assert
            Assert.IsTrue(string.IsNullOrEmpty(result));
        }