Пример #1
0
        public void GetSourceLocation_Type_ReturnsCorrectFileNameIfTypeHasMethodsConstructorsOrProperties(Type type)
        {
            CodeLocation codeLocation = DebugSymbolUtils.GetSourceLocation(type);

            Assert.EndsWith(codeLocation.Path, GetType().Name + ".cs");
            Assert.AreEqual(0, codeLocation.Line);
            Assert.AreEqual(0, codeLocation.Column);
        }
Пример #2
0
        public void GetSourceLocation_Type_ReturnsUnknownIfAssemblyIsDynamic()
        {
            ILogger mockLogger = Mocks.StrictMock <ILogger>();

            Mocks.ReplayAll();

            Assert.AreEqual(CodeLocation.Unknown, DebugSymbolUtils.GetSourceLocation(mockLogger.GetType()));
        }
Пример #3
0
        public void GetSourceLocation_Method_ReturnsValidLocationForConcreteMethod()
        {
            CodeLocation codeLocation = DebugSymbolUtils.GetSourceLocation(typeof(Sample).GetMethod("ConcreteMethod"));

            Assert.EndsWith(codeLocation.Path, GetType().Name + ".cs");
            Assert.Between(codeLocation.Line, 1000, 1003);
            Assert.AreEqual(codeLocation.Column, 0, "No column information should be returned because it is inaccurate.");
        }
Пример #4
0
 public void GetSourceLocation_Type_ReturnsUnknownIfTypeHasNoMembers()
 {
     Assert.AreEqual(CodeLocation.Unknown, DebugSymbolUtils.GetSourceLocation(typeof(EmptyType)));
 }
Пример #5
0
 public void GetSourceLocation_Type_ThrowsIfTypeIsNull()
 {
     DebugSymbolUtils.GetSourceLocation((Type)null);
 }
Пример #6
0
 public void GetSourceLocation_Method_ThrowsIfMethodIsNull()
 {
     DebugSymbolUtils.GetSourceLocation((MethodBase)null);
 }