public Code GetCode() => Class("MyProject", "My project description", "1.0.0", null, "MyTypeName", usingDirectiveList: UsingDirectiveLists.Create("System", "System.IO"), documentationCommentList: Comments.Summary("This is the class XML-doc summary comment"), attributeListCollection: AttributeLists.Create(Attributes.ProtoContract()), constructorList: ConstructorLists.Create(Constructors.Default("MyTypeName")), methodList: MethodLists.Create(Methods.PublicStatic("GetInt", "int", "5 + 5")), propertyList: PropertyLists.Create(Properties.Public("MyProperty", "string", "This is the property XML-doc summary comment", AttributeLists.Create(Attributes.ProtoMember(1)))));
public static ClassDeclaration Create( string name, string @namespace, IEnumerable <Method> tests, IEnumerable <string> usingDirectives) => new ClassDeclaration( name, @namespace, ModifierLists.Public, XUnitUsings.Create(usingDirectives), methodList: MethodLists.Create(tests.ToArray()));
protected MethodList GetMethodList() => Any(Methods) ? MethodLists.Create(Methods.Select(method => string.IsNullOrWhiteSpace(method.ArrowClauseExpression) ? new DevOps.Primitives.CSharp.Method(method.Name, method.Type, GetParameterList(method.Parameters), GetBlock(method.Block), GetMemberModifierList(method.Modifiers), Comments.Summary(method.Comment), GetAttributeListCollection(method.Attributes)) : new DevOps.Primitives.CSharp.Method(method.Name, method.Type, method.ArrowClauseExpression, GetParameterList(method.Parameters), GetMemberModifierList(method.Modifiers), Comments.Summary(method.Comment), GetAttributeListCollection(method.Attributes))).ToArray()) : null;
private static MethodList GetMethodList(IEnumerable <UniqueIndex> uniqueIndexes) => uniqueIndexes == null ? null : MethodLists.Create(DbContextOnModelCreating.Create(uniqueIndexes));