private CodeLocation GetSourceLocationForMethod(string methodName) { ComDebugSymbolResolver resolver = new ComDebugSymbolResolver(AvoidLocks); MethodInfo method = typeof(Sample).GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); return(resolver.GetSourceLocationForMethod(method.DeclaringType.Assembly.Location, method.MetadataToken)); }
public void GetSourceLocationForMethod_ReturnsUnknownIfAssemblyExistsButThereIsNoPDB() { CodeLocation codeLocation = new ComDebugSymbolResolver(AvoidLocks).GetSourceLocationForMethod(typeof(ILogger).Assembly.Location, 0); Assert.AreEqual(CodeLocation.Unknown, codeLocation); }
public void GetSourceLocationForMethod_ReturnsUnknownIfMethodTokenNotValid() { CodeLocation codeLocation = new ComDebugSymbolResolver(AvoidLocks).GetSourceLocationForMethod(GetType().Assembly.Location, 0); }
public void GetSourceLocationForMethod_ReturnsUnknownIfAssemblyFileDoesNotExist() { CodeLocation codeLocation = new ComDebugSymbolResolver(AvoidLocks).GetSourceLocationForMethod("NoSuchAssembly", 0); Assert.AreEqual(CodeLocation.Unknown, codeLocation); }