Dispose FileWatcher in tests
This commit is contained in:
parent
208f0f8a58
commit
206b7b9113
|
|
@ -87,18 +87,19 @@ namespace Microsoft.AspNet.Diagnostics
|
||||||
// Arrange
|
// Arrange
|
||||||
var rootPath = Directory.GetCurrentDirectory();
|
var rootPath = Directory.GetCurrentDirectory();
|
||||||
// PhysicalFileProvider handles only relative paths but we fall back to work with absolute paths too
|
// PhysicalFileProvider handles only relative paths but we fall back to work with absolute paths too
|
||||||
var provider = new PhysicalFileProvider(rootPath);
|
using (var provider = new PhysicalFileProvider(rootPath))
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var middleware = GetErrorPageMiddleware(provider);
|
||||||
|
var stackFrame = middleware.GetStackFrame("func1", absoluteFilePath, lineNumber: 10);
|
||||||
|
|
||||||
// Act
|
// Assert
|
||||||
var middleware = GetErrorPageMiddleware(provider);
|
// Lines 4-16 (inclusive) is the code block
|
||||||
var stackFrame = middleware.GetStackFrame("func1", absoluteFilePath, lineNumber: 10);
|
Assert.Equal(4, stackFrame.PreContextLine);
|
||||||
|
Assert.Equal(GetCodeLines(4, 9), stackFrame.PreContextCode);
|
||||||
// Assert
|
Assert.Equal(GetCodeLines(10, 10), stackFrame.ContextCode);
|
||||||
// Lines 4-16 (inclusive) is the code block
|
Assert.Equal(GetCodeLines(11, 16), stackFrame.PostContextCode);
|
||||||
Assert.Equal(4, stackFrame.PreContextLine);
|
}
|
||||||
Assert.Equal(GetCodeLines(4, 9), stackFrame.PreContextCode);
|
|
||||||
Assert.Equal(GetCodeLines(10, 10), stackFrame.ContextCode);
|
|
||||||
Assert.Equal(GetCodeLines(11, 16), stackFrame.PostContextCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -107,18 +108,19 @@ namespace Microsoft.AspNet.Diagnostics
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var rootPath = Directory.GetCurrentDirectory();
|
var rootPath = Directory.GetCurrentDirectory();
|
||||||
var provider = new PhysicalFileProvider(rootPath);
|
using (var provider = new PhysicalFileProvider(rootPath))
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var middleware = GetErrorPageMiddleware(provider);
|
||||||
|
var stackFrame = middleware.GetStackFrame("func1", relativePath, lineNumber: 10);
|
||||||
|
|
||||||
// Act
|
// Assert
|
||||||
var middleware = GetErrorPageMiddleware(provider);
|
// Lines 4-16 (inclusive) is the code block
|
||||||
var stackFrame = middleware.GetStackFrame("func1", relativePath, lineNumber: 10);
|
Assert.Equal(4, stackFrame.PreContextLine);
|
||||||
|
Assert.Equal(GetCodeLines(4, 9), stackFrame.PreContextCode);
|
||||||
// Assert
|
Assert.Equal(GetCodeLines(10, 10), stackFrame.ContextCode);
|
||||||
// Lines 4-16 (inclusive) is the code block
|
Assert.Equal(GetCodeLines(11, 16), stackFrame.PostContextCode);
|
||||||
Assert.Equal(4, stackFrame.PreContextLine);
|
}
|
||||||
Assert.Equal(GetCodeLines(4, 9), stackFrame.PreContextCode);
|
|
||||||
Assert.Equal(GetCodeLines(10, 10), stackFrame.ContextCode);
|
|
||||||
Assert.Equal(GetCodeLines(11, 16), stackFrame.PostContextCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue