예제 #1
0
 private static string FixExpectation(string expectation)
 {
     if (!DebugInformationTestVariables.TestWithDebugSymbolsAvailable())
     {
         return(string.Format("{0}", OpCodes.Callvirt));
     }
     return(DebugInformationTestVariables.TestWithSourceAvailable()
                                 ? expectation
                                 : string.Format("{0}.cs", ResourceName));
 }
예제 #2
0
        private static void AssertLineInformation(string methodName, string expected)
        {
            var assembly = Db4oToolTestServices.AssemblyFromResource(ResourceName, typeof(DebugInformationTestSuite),
                                                                     DebugInformationTestVariables.TestWithDebugSymbolsAvailable(), SourceHandler);

            var method      = ReflectionServices.FindMethod(assembly, ResourceName, methodName);
            var instruction = ReflectionServices.FindInstruction(method, OpCodes.Callvirt);

            var actual = DebugInformation.InstructionInformationFor(instruction, method.Body.Instructions);

            var fixedExpectation = FixExpectation(expected);

            Assert.IsTrue(actual.Contains(fixedExpectation),
                          string.Format("Expected: {0}, Actual: {1}", fixedExpectation, actual));
        }