예제 #1
0
        private string GenerateCode()
        {
            ClientCodeGenerationOptions options = new ClientCodeGenerationOptions()
            {
                Language            = this._isCSharp ? "C#" : "VisualBasic",
                ClientProjectPath   = "MockProject.proj",
                ClientRootNamespace = "TestRootNS",
                UseFullTypeNames    = this._useFullTypeNames
            };

            MockCodeGenerationHost host      = TestHelper.CreateMockCodeGenerationHost(this.ConsoleLogger, this.MockSharedCodeService);
            ClientCodeGenerator    generator = (ClientCodeGenerator) new CSharpClientCodeGenerator();

            this._domainServiceCatalog = new DomainServiceCatalog(this._domainServiceTypes, this.ConsoleLogger);

            string generatedCode = generator.GenerateCode(host, this._domainServiceCatalog.DomainServiceDescriptions, options);

            return(generatedCode);
        }
예제 #2
0
        public void T4CodeGenTest_VBCodeGenTest()
        {
            Type[] domainServiceTypes           = new Type[] {};
            ClientCodeGenerationOptions options = new ClientCodeGenerationOptions()
            {
                Language            = "VB",
                ClientProjectPath   = "MockProject.proj",
                ClientRootNamespace = "TestRootNS",
                UseFullTypeNames    = false
            };
            ConsoleLogger          consoleLogger         = new ConsoleLogger();
            MockSharedCodeService  mockSharedCodeService = new MockSharedCodeService(Array.Empty <Type>(), Array.Empty <MethodBase>(), Array.Empty <string>());
            MockCodeGenerationHost host                 = TestHelper.CreateMockCodeGenerationHost(consoleLogger, mockSharedCodeService);
            ClientCodeGenerator    generator            = (ClientCodeGenerator) new VBTestClientCodeGenerator();
            DomainServiceCatalog   domainServiceCatalog = new DomainServiceCatalog(domainServiceTypes, consoleLogger);
            string generatedCode = generator.GenerateCode(host, domainServiceCatalog.DomainServiceDescriptions, options);

            Assert.IsTrue(string.IsNullOrEmpty(generatedCode));
            Assert.IsTrue(string.IsNullOrEmpty(consoleLogger.Errors));
        }