Ejemplo n.º 1
0
        public void GetEntityTypeGenerator_returns_correct_customized_entity_type_generator_VB()
        {
            var mockDte = SetupMockProjectWithCustomizedTemplate(@"CodeTemplates\EFModelFromDatabase\Entity.vb.t4");

            var generatorFactory = new CodeGeneratorFactory(mockDte.Project);

            Assert.IsType <CustomGenerator>(generatorFactory.GetEntityTypeGenerator(LangEnum.CSharp));
        }
Ejemplo n.º 2
0
        public void GetContextGenerator_returns_correct_customized_context_generator_if_model_not_empty_VB()
        {
            var mockDte = SetupMockProjectWithCustomizedTemplate(@"CodeTemplates\EFModelFromDatabase\Context.vb.t4");

            var generatorFactory = new CodeGeneratorFactory(mockDte.Project);

            Assert.IsType <CustomGenerator>(generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: false));
        }
        public void GetEntityTypeGenerator_returns_correct_customized_entity_type_generator_VB()
        {
            var mockDte = SetupMockProjectWithCustomizedTemplate(@"CodeTemplates\EFModelFromDatabase\Entity.vb.t4");

            var generatorFactory = new CodeGeneratorFactory(mockDte.Project);

            Assert.IsType<CustomGenerator>(generatorFactory.GetEntityTypeGenerator(LangEnum.CSharp));
        }
Ejemplo n.º 4
0
        public CodeFirstModelGenerator(Project project)
        {
            Debug.Assert(project != null, "project is null.");

            _codeGeneratorFactory = new CodeGeneratorFactory(project);
            _language             = VsUtils.GetLanguageForProject(project);
            Debug.Assert(_language != LangEnum.Unknown, "_language is Unknown.");
        }
        public void GetContextGenerator_returns_correct_customized_context_generator_if_model_not_emtpy_VB()
        {
            var mockDte = SetupMockProjectWithCustomizedTemplate(@"CodeTemplates\EFModelFromDatabase\Context.vb.t4");

            var generatorFactory = new CodeGeneratorFactory(mockDte.Project);

            Assert.IsType<CustomGenerator>(generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: false));
        }
        public CodeFirstModelGenerator(Project project)
        {
            Debug.Assert(project != null, "project is null.");

            _codeGeneratorFactory = new CodeGeneratorFactory(project);
            _language = VsUtils.GetLanguageForProject(project);
            Debug.Assert(_language != LangEnum.Unknown, "_language is Unknown.");
        }
Ejemplo n.º 7
0
        public void GetEntityTypeGenerator_returns_correct_non_customized_entity_type_generator()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of <Project>());

            Assert.IsType <DefaultCSharpEntityTypeGenerator>(
                generatorFactory.GetEntityTypeGenerator(LangEnum.CSharp));
            Assert.IsType <DefaultVBEntityTypeGenerator>(
                generatorFactory.GetEntityTypeGenerator(LangEnum.VisualBasic));
        }
Ejemplo n.º 8
0
        public void GetContextGenerator_returns_correct_non_customized_context_generator_if_model_not_empty()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of <Project>());

            Assert.IsType <DefaultCSharpContextGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.CSharp, isEmptyModel: false));
            Assert.IsType <DefaultVBContextGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: false));
        }
Ejemplo n.º 9
0
        public void GetContextGenerator_returns_correct_context_generator_for_empty_model()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of <Project>());

            Assert.IsType <CSharpCodeFirstEmptyModelGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.CSharp, isEmptyModel: true));
            Assert.IsType <VBCodeFirstEmptyModelGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: true));
        }
        public void GetEntityTypeGenerator_returns_correct_non_customized_entity_type_generator()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of<Project>());

            Assert.IsType<DefaultCSharpEntityTypeGenerator>(
                generatorFactory.GetEntityTypeGenerator(LangEnum.CSharp));
            Assert.IsType<DefaultVBEntityTypeGenerator>(
                generatorFactory.GetEntityTypeGenerator(LangEnum.VisualBasic));
        }
        public void GetContextGenerator_returns_correct_non_customized_context_generator_if_model_not_emtpy()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of<Project>());

            Assert.IsType<DefaultCSharpContextGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.CSharp, isEmptyModel: false));
            Assert.IsType<DefaultVBContextGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: false));
        }
        public void GetContextGenerator_returns_correct_context_generator_for_empty_model()
        {
            var generatorFactory = new CodeGeneratorFactory(Mock.Of<Project>());

            Assert.IsType<CSharpCodeFirstEmptyModelGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.CSharp, isEmptyModel: true));
            Assert.IsType<VBCodeFirstEmptyModelGenerator>(
                generatorFactory.GetContextGenerator(LangEnum.VisualBasic, isEmptyModel: true));
        }