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)); }
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)); }
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)); }
public ShellCodeMethodWriter(CSharpConventionService conventionService) : base(conventionService) { }