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(); }
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); }