diff options
author | Joel Martinez <joelmartinez@gmail.com> | 2018-07-02 22:28:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-02 22:28:53 +0300 |
commit | a8ae91329697a7e43540d23520b1332172653b40 (patch) | |
tree | a7b1e0195835f34f93aefbc682f1a9bea3a6416a /mdoc/mdoc.Test/BasicTests.cs | |
parent | 03edf10b03e5136508dd8b8bdb21b55af650a819 (diff) | |
parent | b4d58f0396f18bf594394359d20f94e71cc926d4 (diff) |
Merge branch 'master' into mdoc-assemble-single-framework
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 c06642c7..1d10d038 100644 --- a/mdoc/mdoc.Test/BasicTests.cs +++ b/mdoc/mdoc.Test/BasicTests.cs @@ -57,5 +57,24 @@ namespace mdoc.Test { return ReadXDocument(xml).ToString(); } + + 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 |