public void TestPropertyDeclaration() { AssemblyTypesInfo assemblyTypesInfo = new AssemblyTypesInfo(Assembly.GetExecutingAssembly()); TypeInfo ti = assemblyTypesInfo.Namespaces["Model.Test.classes.ns1"] .typeInfos.ToDictionary(t => t.FullName)["Model.Test.classes.ns1.Ns1MethodsFieldsProps"]; IEnumerable <string> decs = ti.DeclaredProperties.Select(pi => { return(pi.GetDeclaration()); }).ToList(); IEnumerable <string> decsExpected = new string[] { "Point propPoint { public get private set }", "Point _propPoint { private get private set }" }; Assert.IsTrue(IEnumerableExtension.MembersAreEqual(decsExpected, decs)); }
public void TestTypeDeclaration() { AssemblyTypesInfo assemblyTypesInfo = new AssemblyTypesInfo(Assembly.GetExecutingAssembly()); IEnumerable <string> decs = assemblyTypesInfo.Namespaces["Model.Test.classes.ns1"].GetTypesDeclarations().ToArray(); IEnumerable <string> decsExpected = new string[] { "public struct Struct1", "struct Struct2", "enum Enum", "class Ns1MethodsFieldsProps", "abstract class Ns1AbstractClass", "static class Ns1StrExt" }; Assert.IsTrue(IEnumerableExtension.MembersAreEqual(decsExpected, decs)); }
public void TestFieldDeclaration() { AssemblyTypesInfo assemblyTypesInfo = new AssemblyTypesInfo(Assembly.GetExecutingAssembly()); TypeInfo ti = assemblyTypesInfo.Namespaces["Model.Test.classes.ns1"] .typeInfos.ToDictionary(t => t.FullName)["Model.Test.classes.ns1.Ns1MethodsFieldsProps"]; IEnumerable <string> decs = ti.DeclaredFields.Select(fi => { return(fi.GetDeclaration()); }).ToList(); IEnumerable <string> decsExpected = new string[] { "public Int32 int1", "private Int32 _int2", "Int32 int3", "private Point <propPoint>k__BackingField", "private Point <_propPoint>k__BackingField" }; Assert.IsTrue(IEnumerableExtension.MembersAreEqual(decsExpected, decs)); }
public void TestMethodDeclaration() { AssemblyTypesInfo assemblyTypesInfo = new AssemblyTypesInfo(Assembly.GetExecutingAssembly()); TypeInfo ti = assemblyTypesInfo.Namespaces["Model.Test.classes.ns1"] .typeInfos.ToDictionary(t => t.FullName)["Model.Test.classes.ns1.Ns1MethodsFieldsProps"]; IEnumerable <string> decs = ti.DeclaredMethods.Select(methodInfo => { return(methodInfo.GetDeclaration()); }).ToList(); IEnumerable <string> decsExpected = new string[] { "public Void MethodVoid(Int32 i)", "private String MethodInt(in Int32& inParamInt, out String& outStr, Int32 int1)", "public Point get_propPoint()", "private Point get__propPoint()", "private Void set_propPoint(Point value)", "private Void set__propPoint(Point value)" }; Assert.IsTrue(IEnumerableExtension.MembersAreEqual(decsExpected, decs)); }