예제 #1
0
        public void DeminifyStackTrace_AbleToDeminifyStackTrace_ResultContainsDeminifiedFrame()
        {
            // Arrange
            IStackTraceParser stackTraceParser    = MockRepository.GenerateStrictMock <IStackTraceParser>();
            List <StackFrame> minifiedStackFrames = new List <StackFrame> {
                new StackFrame()
            };
            string stackTraceString = "foobar";

            stackTraceParser.Stub(x => x.ParseStackTrace(stackTraceString)).Return(minifiedStackFrames);

            IStackFrameDeminifier          stackFrameDeminifier     = MockRepository.GenerateStrictMock <IStackFrameDeminifier>();
            StackFrameDeminificationResult stackFrameDeminification = new StackFrameDeminificationResult();

            stackFrameDeminifier.Stub(x => x.DeminifyStackFrame(minifiedStackFrames[0])).Return(stackFrameDeminification);

            StackTraceDeminifier stackTraceDeminifier = new StackTraceDeminifier(stackFrameDeminifier, stackTraceParser);

            // Act
            DeminifyStackTraceResult result = stackTraceDeminifier.DeminifyStackTrace(stackTraceString);

            // Assert
            Assert.AreEqual(1, result.DeminifiedStackFrameResults.Count);
            Assert.AreEqual(minifiedStackFrames[0], result.MinifiedStackFrames[0]);
            Assert.AreEqual(stackFrameDeminification, result.DeminifiedStackFrameResults[0]);
        }
예제 #2
0
        public void DeminifyStackTrace_UnableToParseStackTraceString_ReturnsEmptyList()
        {
            // Arrange
            IStackTraceParser stackTraceParser = MockRepository.GenerateStrictMock <IStackTraceParser>();
            string            stackTraceString = "foobar";

            stackTraceParser.Stub(x => x.ParseStackTrace(stackTraceString)).Return(new List <StackFrame>());

            IStackFrameDeminifier stackFrameDeminifier = MockRepository.GenerateStrictMock <IStackFrameDeminifier>();

            StackTraceDeminifier stackTraceDeminifier = new StackTraceDeminifier(stackFrameDeminifier, stackTraceParser);

            // Act
            DeminifyStackTraceResult result = stackTraceDeminifier.DeminifyStackTrace(stackTraceString);

            // Assert
            Assert.AreEqual(0, result.DeminifiedStackFrameResults.Count);
        }