Exemplo n.º 1
0
        protected override object CallTestMethod(object testClassInstance)
        {
            var modules             = new Dictionary <string, ModuleDefinition>();
            var testType            = ResolveType(TestMethod.DeclaringType, modules);
            var testMethod          = testType.Methods.Single(m => m.MetadataToken.ToInt32() == TestMethod.MetadataToken);
            var methodTypeArguments = TestMethod.GetGenericArguments().Select(t => ResolveType(t, modules)).ToArray();

            var actualResult      = TestMethod.Invoke(testClassInstance, TestMethodArguments);
            var interpretedResult = new Interpreter().InterpretCall(
                new TypeReference[0], testMethod, methodTypeArguments, testClassInstance, TestMethodArguments
                );

            Assert.Equal(actualResult, interpretedResult);
            return(null);
        }