Exemple #1
0
        public void ExtractCreateQueries_Empty1()
        {
            var sqlCodeBuilder = new CodeBuilder("/*", "*/");

            var toBeInserted = new List <ConceptApplication>();

            DatabaseGenerator_Accessor.ExtractCreateQueries(sqlCodeBuilder.GeneratedCode, toBeInserted);
        }
Exemple #2
0
        public void ExtractCreateQueries()
        {
            var sqlCodeBuilder = new CodeBuilder("/*", "*/");

            sqlCodeBuilder.InsertCode("before first");

            var ca1 = new NewConceptApplication(new BaseCi {
                Name = "ci1"
            }, new SimpleConceptImplementation())
            {
                Id          = Guid.NewGuid(),
                CreateQuery = "sql",
                DependsOn   = new ConceptApplicationDependency[] { }
            };

            DatabaseGenerator_Accessor.AddConceptApplicationSeparator(ca1, sqlCodeBuilder);
            const string createQuery1 = "create query 1";

            sqlCodeBuilder.InsertCode(createQuery1);

            var ca2 = new NewConceptApplication(new BaseCi {
                Name = "ci2"
            }, new SimpleConceptImplementation())
            {
                Id          = Guid.NewGuid(),
                CreateQuery = "sql",
                DependsOn   = new ConceptApplicationDependency[] { }
            };

            DatabaseGenerator_Accessor.AddConceptApplicationSeparator(ca2, sqlCodeBuilder);
            const string createQuery2 = "create query 2";

            sqlCodeBuilder.InsertCode(createQuery2);

            var toBeInserted = new List <ConceptApplication> {
                ca1, ca2
            };

            DatabaseGenerator_Accessor.ExtractCreateQueries(sqlCodeBuilder.GeneratedCode, toBeInserted);

            Assert.AreEqual(createQuery1, ca1.CreateQuery);
            Assert.AreEqual(createQuery2, ca2.CreateQuery);
        }