public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Test.TestClass .CreateClassBuilder("TestClass") .AddProperty("DontCare", "List<string>") .Commit() // Test.TestClass<T1> .CreateClassBuilder("TestClass") .AddGenericParameter("T1") .AddProperty("AlsoDontCare", "int") .Commit() // Test.TestClass<T1, T2> .CreateClassBuilder("TestClass") .AddGenericParameter("T1") .AddGenericParameter("T2") .AddProperty("TestClass_1_Prop", "TestClass<int>") .AddProperty("TestClass_Prop", "TestClass") .Commit() ; wkspBuilder.ClassParseFilter = new AlwaysAcceptFilter(); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // create a class that isn't extracted .CreateClassBuilder(Class_NotExtracted) .AddProperty("WhoCares", "int") .Commit() // Create another class that is extracted .CreateClassBuilder(Class_OtherExtracted) .AddProperty("AlsoWhoCares", "string") .Commit() // And create an extracted class that get all .CreateClassBuilder(Class_Extracted) .AddProperty(Prop_NotExtracted, Class_NotExtracted) .AddProperty(Prop_OtherExtracted, Class_OtherExtracted) .AddProperty(Prop_ExtractedRecursive, Class_Extracted) .Commit(); // Exclude the non extracted wkspBuilder.ClassParseFilter = new ExcludeWithAnyName(Class_NotExtracted); _packageTester = wkspBuilder.GetPackageTester(); }
public virtual void TestInitialize() { WorkspaceBuilder = new TestWorkspaceBuilder(); WorkspaceBuilder.DefaultProject .AddFakeTypeRight() ; }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Display name attribute .CreateClassBuilder("DisplayNameAttribute") .AddBaseClass("Attribute") .AddProperty("DisplayName", "string") .AddProperty("Abbreviation", "string") .AddConstructor() .Commit() .AddConstructor() .AddParameter("dispName", "string") .Commit() .AddConstructor() .AddParameter("dispName", "string") .AddParameter("abbrev", "string") .Commit() .Commit() // Simple enum .CreateEnumBuilder("SimpleEnum") .AddMember("One", "1").Commit() .AddMember("Two", "2") .AddAttribute("DisplayNameAttribute") .AddConstructorArg("\"TestTwoName\"") .Commit() .Commit() .AddMember("Three", "3").Commit() .AddMember("Four", "44").Commit() .AddMember("Five", "5") .AddAttribute("DisplayNameAttribute") .AddConstructorArg("\"TestFiveName\"") .AddConstructorArg("\"TFiveAbbr\"") .Commit() .Commit() .AddMember("Six", "6") .AddAttribute("DisplayNameAttribute") .AddNamedArg("DisplayName", "\"SixDispName\"") .AddNamedArg("Abbreviation", "\"SixAbbr\"") .Commit() .Commit() .Commit() // Simple class .CreateClassBuilder("SimpleClass") .AddProperty("EnumProp", "SimpleEnum") .Commit() ; wkspBuilder.EnumParseFilter = new AlwaysAcceptFilter(); wkspBuilder.DisplayNameFilter = new AcceptWithName("DisplayNameAttribute"); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Simple Generic Class with Type Param .CreateClassBuilder(Class_SimpleGeneric) .AddGenericParameter(GenericParameterName) .AddProperty(GenericPropertyName, GenericParameterName) .Commit() // Generic that inherits from the simple generic .CreateClassBuilder("ExtendedGeneric") .AddGenericParameter("T") .AddBaseClass(Class_SimpleGeneric + "<T>") .AddProperty(Property_ExtendedGenericProp, "T") .Commit() // NonExtracted Base Generic .CreateClassBuilder("NonExtractedGeneric") .AddGenericParameter("TType") .AddProperty("IsStillExtracted", "TType") .Commit() // Extract derived from non extracted base .CreateClassBuilder("ExtendedGenericWithBaseNonExtracted") .AddBaseClass("NonExtractedGeneric<T>") .AddGenericParameter("T") .AddProperty("ExtractedYay", "T") .AddProperty("ExtractedGeneric", $"{Class_SimpleGeneric}<int>") .Commit() // Derived class with resolved TypeParam .CreateClassBuilder("ExtendsGenericWithResolved") .AddBaseClass(Class_SimpleGeneric + "<bool>") .AddProperty("DontCareProperty", "int") .Commit() // Derived class with resolved TypeParam .CreateClassBuilder("ExtendsNonExtractedGenericWithResolved") .AddBaseClass("NonExtractedGeneric<string>") .AddProperty("AlsoDontCareProperty", "int") .Commit() ; wkspBuilder.ClassParseFilter = new ExcludeWithAnyName("NonExtractedGeneric"); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject .CreateClassBuilder(ClassName) .AddProperty(StringListProperty, "List<string>") .AddProperty(StringIntDictionaryProperty, "Dictionary<string, int>") .AddProperty("EnumerableString", "IEnumerable<string>") .AddProperty("EnumerableObject", "System.Collections.IEnumerable") .Commit(); wkspBuilder.ClassParseFilter = new AlwaysAcceptFilter(); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject .CreateClassBuilder(ClassName) .AddProperty(IntegerPropName, "int") .AddProperty(StringPropName, "string") .AddProperty(NullableIntPropName, "int?") .AddProperty(IntegerArrayPropName, "int[]") .Commit(); wkspBuilder.ClassParseFilter = new AlwaysAcceptFilter(); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Simple Generic Class with Type Param .CreateClassBuilder("SimpleClass") .SetDocumentationComments("These are comments") .AddProperty("SimpleProp", "int", "Property Comments Here") .Commit() ; wkspBuilder.ClassParseFilter = new AlwaysAcceptFilter(); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Simple Base class, extracted .CreateClassBuilder(SimpleBaseClassName) .AddProperty(BaseClassIntProperty, "int") .Commit() // Simple derived class, extracted .CreateClassBuilder(SimpleDerivedClassName) .AddBaseClass(SimpleBaseClassName) .AddProperty(DerivedClassStringProperty, "string") .Commit() // Non extracted base class .CreateClassBuilder("NotExtracted") .AddProperty("IsStillExtractedProperty", "string") .Commit() // Extracted derived class of non extracted .CreateClassBuilder("ExtendsNotExtracted") .AddBaseClass("NotExtracted") .AddProperty("ExtendsNotExtProperty", "int") .Commit() // Not extracted, but base is extracted .CreateClassBuilder("NotExtractedWithBase") .AddBaseClass(SimpleBaseClassName) .AddProperty("NotExtractedWithBaseProp", "int") .Commit() // Extracted with non-extracted base .CreateClassBuilder("ExtractedWithNonExtractedBase") .AddBaseClass("NotExtractedWithBase") .AddProperty("MyExtractedOProp", "string") .Commit() .CreateInterfaceBuilder("IBaseInterface") .AddProperty("BaseProperty", "string") .Commit() .CreateInterfaceBuilder("IDerivedInterface") .AddBaseInterface("IBaseInterface") .AddProperty("DerivedProp", "int") .Commit() .CreateInterfaceBuilder("IComplexDerivedInterface") .AddBaseInterface("IBaseInterface") .AddBaseInterface("IDerivedInterface") .AddBaseInterface("INotExtractedInterface") .AddProperty("ComplexDerivedProp", "int") .Commit() .CreateInterfaceBuilder("INotExtractedInterface") .AddProperty("NotExtractedProp", "int") .Commit() .CreateInterfaceBuilder("IGenericDerivedInterface") .AddBaseInterface("IBaseInterface") .AddGenericParameter("T") .AddProperty("GenericProp", "T") .Commit() ; wkspBuilder.ClassParseFilter = new ExcludeWithAnyName("NotExtracted", "NotExtractedWithBase", "INotExtractedInterface"); _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Dummy MvcActionAttribute .CreateClassBuilder("DummyAttribute") .AddBaseClass("Attribute") .Commit() // Test class to use as return/param .CreateClassBuilder("TestClass") .AddProperty("DontCare", "int") .Commit() // Not Extracted .CreateClassBuilder("NotExtracted") .AddProperty("DontCare", "int") .Commit() // Fake JsonResult-like class .CreateClassBuilder("FakeJsonResultLikeClass") .AddProperty("DontCare", "int") .Commit() // Display name attribute .CreateClassBuilder("SimpleController") // Fake Json Method - not extracted .AddMethod("FakeJson", "FakeJsonResultLikeClass") .AddParameter("data", "object") .AddLineOfCode("return null;", 0) .Commit() .AddMethod("SimpleAnonymousType", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return FakeJson(new { stringProp = \"Hi\", intProp = 1 });", 0) .Commit() .AddMethod("AnonymousTypeWithExtracted", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("TestClass test = new TestClass();", 0) .AddLineOfCode("return FakeJson(new { testClassProp = test, intProp = 1 });", 0) .Commit() .AddMethod("AnonymousTypeWithNonExtracted", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("NotExtracted test = new NotExtracted();", 0) .AddLineOfCode("return FakeJson(new { testClassProp = test, intProp = 1 });", 0) .Commit() .Commit() ; wkspBuilder.ClassParseFilter = new ExcludeWithAnyName("DummyAttribute", "SimpleController", "FakeJsonResultLikeClass", "NotExtracted"); wkspBuilder.ControllerParseFilter = new AlwaysAcceptFilter(); wkspBuilder.MvcActionFilter = new AlwaysAcceptFilter(); MethodReturnTypeHandler handler = new ParseSyntaxForTypeMethodHandler( "Test.FakeJsonResultLikeClass", new InvocationReturnForwardFilter("FakeJson", 0) ); ParseOptions parseOptions = new ParseOptions(); parseOptions.MethodReturnTypeHandlers.Add(handler); wkspBuilder.ParseOptions = parseOptions; _packageTester = wkspBuilder.GetPackageTester(); }
public void SetupParse() { TestWorkspaceBuilder wkspBuilder = new TestWorkspaceBuilder(); wkspBuilder.DefaultProject // Dummy MvcActionAttribute .CreateClassBuilder("DummyAttribute") .AddBaseClass("Attribute") .Commit() // Test class to use as return/param .CreateClassBuilder("TestClass") .AddProperty("DontCare", "int") .Commit() // Test generic class to use as return/param .CreateClassBuilder("TestGenericClass") .AddGenericParameter("T") .AddProperty("GenericProp", "T") .Commit() // Not Extracted .CreateClassBuilder("NotExtracted") .AddProperty("DontCare", "int") .Commit() // Fake JsonResult-like class .CreateClassBuilder("FakeJsonResultLikeClass") .AddProperty("DontCare", "int") .Commit() // Display name attribute .CreateClassBuilder("SimpleController") // Fake Json Method - not extracted .AddMethod("FakeJson", "FakeJsonResultLikeClass") .AddParameter("data", "object") .AddLineOfCode("return null;", 0) .Commit() .AddMethod("ARandomMethod", "TestClass") // Random Method .AddLineOfCode("return null;", 0) .Commit() .AddMethod("StringResult", "string") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return \"Hi\";", 0) .Commit() .AddMethod("NewObjectResult", "TestClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return new TestClass();", 0) .Commit() .AddMethod("NewObjectResult_Json", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return FakeJson(new TestClass());", 0) .Commit() .AddMethod("VariableResult", "bool") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("bool testVar = true;", 0) .AddLineOfCode("return testVar;", 0) .Commit() .AddMethod("VariableResult_Json", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("bool testVar = true;", 0) .AddLineOfCode("return FakeJson(testVar);", 0) .Commit() .AddMethod("StringConcatResult", "string") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return \"Hello\" + \"World\";", 0) .Commit() .AddMethod("MethodResult", "TestClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return ARandomMethod();", 0) .Commit() .AddMethod("SimpleParameter_Json", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddParameter("testParam", "TestClass") .AddLineOfCode("return FakeJson(testParam);", 0) .Commit() .AddMethod("NotExtracted_Json", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("return FakeJson(new NotExtracted());", 0) .Commit() .AddMethod("ComplexMethod", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddParameter("dateStringDict", "Dictionary<DateTime, string>") .AddParameter("intStringDict", "Dictionary<int, string>") .AddParameter("stringStringDict", "Dictionary<string, string>") .AddLineOfCode("TestGenericClass<TestClass> gen = new TestGenericClass<TestClass>();", 0) .AddLineOfCode("return FakeJson(gen);", 0) .Commit() .AddMethod("GenericPropReturn_Json", "FakeJsonResultLikeClass") .AddAttribute("DummyAttribute").Commit() .AddLineOfCode("TestGenericClass<TestClass> gen = new TestGenericClass<TestClass>();", 0) .AddLineOfCode("return FakeJson(gen.GenericProp);", 0) .Commit() .Commit() ; wkspBuilder.ClassParseFilter = new ExcludeWithAnyName("DummyAttribute", "SimpleController", "FakeJsonResultLikeClass", "NotExtracted"); wkspBuilder.ControllerParseFilter = new AlwaysAcceptFilter(); wkspBuilder.MvcActionFilter = new AlwaysAcceptFilter(); MethodReturnTypeHandler handler = new ParseSyntaxForTypeMethodHandler( "Test.FakeJsonResultLikeClass", new InvocationReturnForwardFilter("FakeJson", 0) ); ParseOptions parseOptions = new ParseOptions(); parseOptions.MethodReturnTypeHandlers.Add(handler); wkspBuilder.ParseOptions = parseOptions; _packageTester = wkspBuilder.GetPackageTester(); }