diff options
author | Mikhail Melnikov <mikhail_melnikov@epam.com> | 2018-05-15 18:45:22 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2018-05-29 23:54:41 +0300 |
commit | 047f5c951965c0a131d581c58eb2af0ba341c48d (patch) | |
tree | 30706e3d0b720d9c403fa8133eaebd861df3f3ed /mdoc/mdoc.Test/BasicTests.cs | |
parent | f92ac8bcf7f4c0f7c1f12c3d23c1e5a829d7041d (diff) |
Fixed missing API for VisualC reflected binary
For some C++ classes, generic parameters doesn't exist before `Resolve` is called. Added `type = type.Resolve();` for types with IsRequiredModifier == true.
Closes #200
Diffstat (limited to 'mdoc/mdoc.Test/BasicTests.cs')
-rw-r--r-- | mdoc/mdoc.Test/BasicTests.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mdoc/mdoc.Test/BasicTests.cs b/mdoc/mdoc.Test/BasicTests.cs index cddbcbd8..15c81e7b 100644 --- a/mdoc/mdoc.Test/BasicTests.cs +++ b/mdoc/mdoc.Test/BasicTests.cs @@ -41,5 +41,24 @@ namespace mdoc.Test var moduleName = type.Module.FullyQualifiedName; return GetType(moduleName, type.FullName); } + + protected MethodDefinition GetMethod(TypeDefinition testclass, Func<MethodDefinition, bool> query) + { + var methods = testclass.Methods; + var member = methods.FirstOrDefault(query)?.Resolve(); + if (member == null) + throw new Exception("Did not find the member in the test class"); + return member; + } + + protected MethodDefinition GetMethod(Type type, Func<MethodDefinition, bool> query) + { + return GetMethod(GetType(type), query); + } + + protected MethodDefinition GetMethod(Type type, string name) + { + return GetMethod(GetType(type), i => i.Name == name); + } } }
\ No newline at end of file |