コード例 #1
0
        public void Generate()
        {
            // Create the appropriate usings for the EntityFramework;
            IORMUsings baseUsings      = new EntityFrameworkBaseORMUsings(_context);
            IORMUsings concreteUsings  = new EntityFrameworkConcreteORMUsings(_context);
            IORMUsings interfaceUsings = new EntityFrameworkInterfaceORMUsings(_context);

            // Instantiate and new derived class from the StandardORMFramework class
            // that accepts "usings".
            StandardORMFramework orm = new DerivedWithUsingsFromStandardORMFramework(_context, baseUsings, concreteUsings, interfaceUsings);

            orm.Generate();
        }
コード例 #2
0
        public void standard_orm_class_with_entityframework_usings()
        {
            // Arrange
            IORMUsings usings         = new EntityFrameworkBaseORMUsings(_context);
            IORMUsings concreteUsings = new EntityFrameworkConcreteORMUsings(_context);

            IORMFramework orm = new DerivedWithUsingsFromStandardORMFramework(_context, usings, concreteUsings, null);

            // Act
            orm.Generate();
            StringBuilder expected = new StringBuilder();

            expected.AppendLine("using System;");
            expected.AppendLine("using System.Collections.Generic;");
            expected.AppendLine("using System.Data;");
            expected.AppendLine("using System.Linq;");
            expected.AppendLine("");
            expected.AppendLine("using BlogApp.DataObjects.Interfaces;");
            expected.AppendLine("using BlogApp.DataObjects.EntityFramework.EntityMapper;");
            expected.AppendLine("namespace BlogApp.DataObjects.EntityFramework.SQLServer");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic class BlogBaseDao : ICRUDDao<BlogApp.BusinessObjects.Blog>");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");
            expected.AppendLine("using System;");
            expected.AppendLine("using System.Collections.Generic;");
            expected.AppendLine("using System.Linq;");
            expected.AppendLine("using System.Linq.Dynamic;");
            expected.AppendLine("using BlogApp.DataObjects.Interfaces;");
            expected.AppendLine("using BlogApp.DataObjects.EntityFramework.EntityMapper;");
            expected.AppendLine("namespace BlogApp.DataObjects.EntityFramework.SQLServer");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic class SQLServerBlogDao : BlogBaseDao, IBlogDao");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");
            expected.AppendLine("namespace BlogApp.DataObjects.Interfaces");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic interface IBlogDao : ICRUDDao<BlogApp.BusinessObjects.Blog>");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");

            // Assert
            Assert.AreEqual(expected.ToString(), _output.text);
        }
コード例 #3
0
        public void standard_orm_class_with_entityframework_usings()
        {
            // Arrange
            IORMUsings usings = new EntityFrameworkBaseORMUsings(_context);
            IORMUsings concreteUsings = new EntityFrameworkConcreteORMUsings(_context);

            IORMFramework orm = new DerivedWithUsingsFromStandardORMFramework(_context, usings, concreteUsings, null);

            // Act
            orm.Generate();
            StringBuilder expected = new StringBuilder();
            expected.AppendLine("using System;");
            expected.AppendLine("using System.Collections.Generic;");
            expected.AppendLine("using System.Data;");
            expected.AppendLine("using System.Linq;");
            expected.AppendLine("");
            expected.AppendLine("using BlogApp.DataObjects.Interfaces;");
            expected.AppendLine("using BlogApp.DataObjects.EntityFramework.EntityMapper;");
            expected.AppendLine("namespace BlogApp.DataObjects.EntityFramework.SQLServer");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic class BlogBaseDao : ICRUDDao<BlogApp.BusinessObjects.Blog>");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");
            expected.AppendLine("using System;");
            expected.AppendLine("using System.Collections.Generic;");
            expected.AppendLine("using System.Linq;");
            expected.AppendLine("using System.Linq.Dynamic;");
            expected.AppendLine("using BlogApp.DataObjects.Interfaces;");
            expected.AppendLine("using BlogApp.DataObjects.EntityFramework.EntityMapper;");
            expected.AppendLine("namespace BlogApp.DataObjects.EntityFramework.SQLServer");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic class SQLServerBlogDao : BlogBaseDao, IBlogDao");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");
            expected.AppendLine("namespace BlogApp.DataObjects.Interfaces");
            expected.AppendLine("{");
            expected.AppendLine("\tpublic interface IBlogDao : ICRUDDao<BlogApp.BusinessObjects.Blog>");
            expected.AppendLine("\t{");
            expected.AppendLine("\t");
            expected.AppendLine("\t}");
            expected.AppendLine("}");

            // Assert
            Assert.AreEqual(expected.ToString(), _output.text);
        }
コード例 #4
0
        public void Generate()
        {
            // Create the appropriate usings for the EntityFramework;
            IORMUsings baseUsings = new EntityFrameworkBaseORMUsings(_context);
            IORMUsings concreteUsings = new EntityFrameworkConcreteORMUsings(_context);
            IORMUsings interfaceUsings = new EntityFrameworkInterfaceORMUsings(_context);

            // Instantiate and new derived class from the StandardORMFramework class
            // that accepts "usings".
            StandardORMFramework orm = new DerivedWithUsingsFromStandardORMFramework(_context, baseUsings, concreteUsings, interfaceUsings);
            orm.Generate();
        }