예제 #1
0
        public void SimpleStackFrameDeminierDeminifyStackFrame_GetWRappingFunctionForSourceLocationReturnsNull_NoWrapingFunctionDeminificationError()
        {
            // Arrange
            string     filePath   = "foo";
            StackFrame stackFrame = new StackFrame {
                FilePath = filePath
            };
            IFunctionMapStore functionMapStore = MockRepository.GenerateStub <IFunctionMapStore>();

            functionMapStore.Stub(c => c.GetFunctionMapForSourceCode(filePath))
            .Return(new List <FunctionMapEntry>());
            IFunctionMapConsumer functionMapConsumer = MockRepository.GenerateStub <IFunctionMapConsumer>();

            functionMapConsumer.Stub(c => c.GetWrappingFunctionForSourceLocation(Arg <SourcePosition> .Is.Anything, Arg <List <FunctionMapEntry> > .Is.Anything))
            .Return(null);

            IStackFrameDeminifier stackFrameDeminifier = GetStackFrameDeminifierWithMockDependencies(functionMapStore: functionMapStore, functionMapConsumer: functionMapConsumer, useSimpleStackFrameDeminier: true);

            // Act
            StackFrameDeminificationResult stackFrameDeminification = stackFrameDeminifier.DeminifyStackFrame(stackFrame, callerSymbolName: null);

            // Assert
            Assert.Equal(DeminificationError.NoWrapingFunctionFound, stackFrameDeminification.DeminificationError);
            Assert.Null(stackFrameDeminification.DeminifiedStackFrame.MethodName);
            Assert.Null(stackFrameDeminification.DeminifiedStackFrame.SourcePosition);
            Assert.Null(stackFrameDeminification.DeminifiedStackFrame.FilePath);
        }
예제 #2
0
        public void StackFrameDeminierDeminifyStackFrame_SourceMapParsingNull_SourceMapFailedToParseError()
        {
            // Arrange
            string           filePath = "foo";
            FunctionMapEntry wrapingFunctionMapEntry = new FunctionMapEntry {
                DeminfifiedMethodName = "DeminifiedFoo"
            };
            StackFrame stackFrame = new StackFrame {
                FilePath = filePath
            };
            IFunctionMapStore functionMapStore = MockRepository.GenerateStub <IFunctionMapStore>();

            functionMapStore.Stub(c => c.GetFunctionMapForSourceCode(filePath))
            .Return(new List <FunctionMapEntry>());
            IFunctionMapConsumer functionMapConsumer = MockRepository.GenerateStub <IFunctionMapConsumer>();

            functionMapConsumer.Stub(c => c.GetWrappingFunctionForSourceLocation(Arg <SourcePosition> .Is.Anything, Arg <List <FunctionMapEntry> > .Is.Anything))
            .Return(wrapingFunctionMapEntry);
            ISourceMapStore sourceMapStore = MockRepository.GenerateStub <ISourceMapStore>();

            sourceMapStore.Stub(c => c.GetSourceMapForUrl(Arg <string> .Is.Anything)).Return(new SourceMap());

            IStackFrameDeminifier stackFrameDeminifier = GetStackFrameDeminifierWithMockDependencies(sourceMapStore: sourceMapStore, functionMapStore: functionMapStore, functionMapConsumer: functionMapConsumer);

            // Act
            StackFrameDeminificationResult stackFrameDeminification = stackFrameDeminifier.DeminifyStackFrame(stackFrame, callerSymbolName: null);

            // Assert
            Assert.Equal(DeminificationError.SourceMapFailedToParse, stackFrameDeminification.DeminificationError);
            Assert.Equal(wrapingFunctionMapEntry.DeminfifiedMethodName, stackFrameDeminification.DeminifiedStackFrame.MethodName);
            Assert.Null(stackFrameDeminification.DeminifiedStackFrame.SourcePosition);
            Assert.Null(stackFrameDeminification.DeminifiedStackFrame.FilePath);
        }