public void MethodBodyGetterCall() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PUBLIC }, new List <ParameterDescription>(), "void", isConstructor: false ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var methodBodyGetter = new MockMethodBodyGetter(); var methodProxyGenerator = new MethodProxyGenerator(methodBodyGetter); var constructorProxyGenerator = new ConstructorProxyGenerator(methodBodyGetter); var classProxyGenerator = new ClassProxyGenerator(methodProxyGenerator, constructorProxyGenerator); classProxyGenerator.Generate(classDescription); Assert.AreEqual(1, methodBodyGetter.CallsCount); Assert.AreEqual("myMethod", methodBodyGetter.CallArgumentName); }
public ClassProxyGenerator_should() { var methodBodyGetter = new MethodBodyGetter("classRef", "jObject"); var methodProxyGenerator = new MethodProxyGenerator(methodBodyGetter); var constructorProxyGenerator = new ConstructorProxyGenerator(methodBodyGetter); classProxyGenerator = new ClassProxyGenerator(methodProxyGenerator, constructorProxyGenerator); }
public void Generate( LibraryDescription description, string assemblyName, string assemblyOutputPath, Action <IEnumerable <string> > sourceLogger = null, Action <string> compiltionLogger = null) { var methodBodyGetter = new MethodBodyGetter("classRef", "jObject"); var methodProxyGenerator = new MethodProxyGenerator(methodBodyGetter); var constructorProxyGenerator = new ConstructorProxyGenerator(methodBodyGetter); var classGenerator = new ClassProxyGenerator(methodProxyGenerator, constructorProxyGenerator); var proxySource = new LibraryProxyGenerator(classGenerator).Generate(description); var trees = CompilationTreesGetter.GetCompilationTreesFrom(proxySource); sourceLogger?.Invoke(trees.Select(el => el .GetRoot() .NormalizeWhitespace() .ToFullString()) ); new Compiller().Compile(trees, assemblyName, assemblyOutputPath, compiltionLogger); }