コード例 #1
0
        public ShellWriter(string rootPath, string clientNamespaceName) : base(rootPath, clientNamespaceName)
        {
            var conventionService = new CSharpConventionService();

            AddOrReplaceCodeElementWriter(new CodeClassDeclarationWriter(conventionService));
            AddOrReplaceCodeElementWriter(new CodeBlockEndWriter(conventionService));
            AddOrReplaceCodeElementWriter(new CodeEnumWriter(conventionService));
            AddOrReplaceCodeElementWriter(new CodeIndexerWriter(conventionService));
            AddOrReplaceCodeElementWriter(new ShellCodeMethodWriter(conventionService));
            AddOrReplaceCodeElementWriter(new CodePropertyWriter(conventionService));
            AddOrReplaceCodeElementWriter(new CodeTypeWriter(conventionService));
        }
コード例 #2
0
        public CSharpWriter(string rootPath, string clientNamespaceName, bool usesBackingStore)
        {
            PathSegmenter = new CSharpPathSegmenter(rootPath, clientNamespaceName);
            var conventionService = new CSharpConventionService();

            AddCodeElementWriter(new CodeClassDeclarationWriter(conventionService));
            AddCodeElementWriter(new CodeClassEndWriter(conventionService));
            AddCodeElementWriter(new CodeEnumWriter(conventionService));
            AddCodeElementWriter(new CodeIndexerWriter(conventionService));
            AddCodeElementWriter(new CodeMethodWriter(conventionService, usesBackingStore));
            AddCodeElementWriter(new CodePropertyWriter(conventionService));
            AddCodeElementWriter(new CodeTypeWriter(conventionService));
        }
コード例 #3
0
        public void TranslatesType()
        {
            var service         = new CSharpConventionService();
            var root            = CodeNamespace.InitRootNamespace();
            var unknownTypeMock = new Mock <CodeTypeBase>();

            unknownTypeMock.Setup(x => x.Name).Returns("unkownType");
            Assert.Throws <InvalidOperationException>(() => service.TranslateType(unknownTypeMock.Object));
            var stringType = new CodeType {
                Name = "string"
            };

            Assert.Equal("string", service.TranslateType(stringType));
            var unionStringType = new CodeUnionType {
                Name = "unionString"
            };

            unionStringType.AddType(stringType);
            Assert.Equal("string", service.TranslateType(unionStringType));
        }
コード例 #4
0
 public ShellCodeMethodWriter(CSharpConventionService conventionService) : base(conventionService)
 {
 }