public ClassDeclarationInfo Build() { var classDeclarationInfo = new ClassDeclarationInfo(_name, _namespaceName); classDeclarationInfo.Methods.AddRange(_methods.Select(m => m.Build())); return(classDeclarationInfo); }
public void ShouldBeAbleToSayWhetherItsNameMatchesAPattern(string pattern, string className, bool expectedResult) { //GIVEN var declaration = new ClassDeclarationInfo(className, Any.String()); var @class = new CSharpClass(declaration, Any.Array <ICSharpMethod>()); //WHEN var nameMatches = @class.NameMatches(Pattern.WithoutExclusion(pattern)); //THEN nameMatches.Should().Be(expectedResult); }
private static string Interior(ClassDeclarationInfo classDeclaration, Func <MethodDeclarationInfo, string> generateMethod) { return(string.Join(Environment.NewLine, classDeclaration.Methods.Select(generateMethod))); }
private static string GenerateClass(ClassDeclarationInfo c, Func <MethodDeclarationInfo, string> generateMethod) { return("public class " + c.Name + "{" + Interior(c, generateMethod) + "}"); }
public CSharpClass(ClassDeclarationInfo classDeclarationInfo, ICSharpMethod[] methods) { _classDeclarationInfo = classDeclarationInfo; _methods = methods; }