Handle IFileSystem rename.

This commit is contained in:
Chris Ross 2015-01-20 08:58:41 -08:00
parent 60c3e7e971
commit 96835bd761
14 changed files with 53 additions and 53 deletions

View File

@ -1,5 +1,5 @@
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles; using Microsoft.AspNet.StaticFiles;
using Microsoft.Framework.Logging; using Microsoft.Framework.Logging;
using Microsoft.Framework.Logging.Console; using Microsoft.Framework.Logging.Console;

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNet.StaticFiles
/// <param name="options">The configuration options for this middleware.</param> /// <param name="options">The configuration options for this middleware.</param>
public DefaultFilesMiddleware([NotNull] RequestDelegate next, [NotNull] IHostingEnvironment hostingEnv, [NotNull] DefaultFilesOptions options) public DefaultFilesMiddleware([NotNull] RequestDelegate next, [NotNull] IHostingEnvironment hostingEnv, [NotNull] DefaultFilesOptions options)
{ {
options.ResolveFileSystem(hostingEnv); options.ResolveFileProvider(hostingEnv);
_next = next; _next = next;
_options = options; _options = options;
@ -47,14 +47,14 @@ namespace Microsoft.AspNet.StaticFiles
if (Helpers.IsGetOrHeadMethod(context.Request.Method) if (Helpers.IsGetOrHeadMethod(context.Request.Method)
&& Helpers.TryMatchPath(context, _matchUrl, forDirectory: true, subpath: out subpath)) && Helpers.TryMatchPath(context, _matchUrl, forDirectory: true, subpath: out subpath))
{ {
var dirContents = _options.FileSystem.GetDirectoryContents(subpath.Value); var dirContents = _options.FileProvider.GetDirectoryContents(subpath.Value);
if (dirContents.Exists) if (dirContents.Exists)
{ {
// Check if any of our default files exist. // Check if any of our default files exist.
for (int matchIndex = 0; matchIndex < _options.DefaultFileNames.Count; matchIndex++) for (int matchIndex = 0; matchIndex < _options.DefaultFileNames.Count; matchIndex++)
{ {
string defaultFile = _options.DefaultFileNames[matchIndex]; string defaultFile = _options.DefaultFileNames[matchIndex];
var file = _options.FileSystem.GetFileInfo(subpath + defaultFile); var file = _options.FileProvider.GetFileInfo(subpath + defaultFile);
// TryMatchPath will make sure subpath always ends with a "/" by adding it if needed. // TryMatchPath will make sure subpath always ends with a "/" by adding it if needed.
if (file.Exists) if (file.Exists)
{ {

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.StaticFiles
{ {
throw new ArgumentException(Resources.Args_NoFormatter); throw new ArgumentException(Resources.Args_NoFormatter);
} }
options.ResolveFileSystem(hostingEnv); options.ResolveFileProvider(hostingEnv);
_next = next; _next = next;
_options = options; _options = options;
@ -69,7 +69,7 @@ namespace Microsoft.AspNet.StaticFiles
private bool TryGetDirectoryInfo(PathString subpath, out IDirectoryContents contents) private bool TryGetDirectoryInfo(PathString subpath, out IDirectoryContents contents)
{ {
contents = _options.FileSystem.GetDirectoryContents(subpath.Value); contents = _options.FileProvider.GetDirectoryContents(subpath.Value);
return contents.Exists; return contents.Exists;
} }
} }

View File

@ -8,7 +8,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.StaticFiles namespace Microsoft.AspNet.StaticFiles

View File

@ -3,7 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.StaticFiles namespace Microsoft.AspNet.StaticFiles

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.StaticFiles.Infrastructure namespace Microsoft.AspNet.StaticFiles.Infrastructure
@ -41,6 +41,6 @@ namespace Microsoft.AspNet.StaticFiles.Infrastructure
/// <summary> /// <summary>
/// The file system used to locate resources /// The file system used to locate resources
/// </summary> /// </summary>
public IFileSystem FileSystem { get; set; } public IFileProvider FileProvider { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
@ -45,20 +45,20 @@ namespace Microsoft.AspNet.StaticFiles.Infrastructure
/// <summary> /// <summary>
/// The file system used to locate resources /// The file system used to locate resources
/// </summary> /// </summary>
public IFileSystem FileSystem public IFileProvider FileProvider
{ {
get { return SharedOptions.FileSystem; } get { return SharedOptions.FileProvider; }
set { SharedOptions.FileSystem = value; } set { SharedOptions.FileProvider = value; }
} }
internal void ResolveFileSystem(IHostingEnvironment hostingEnv) internal void ResolveFileProvider(IHostingEnvironment hostingEnv)
{ {
if (FileSystem == null) if (FileProvider == null)
{ {
FileSystem = hostingEnv.WebRootFileSystem; FileProvider = hostingEnv.WebRootFileProvider;
if (FileSystem == null) if (FileProvider == null)
{ {
throw new InvalidOperationException("Missing FileSystem."); throw new InvalidOperationException("Missing FileProvider.");
} }
} }
} }

View File

@ -7,7 +7,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Headers; using Microsoft.AspNet.Http.Headers;
using Microsoft.AspNet.Http.Interfaces; using Microsoft.AspNet.Http.Interfaces;
@ -127,7 +127,7 @@ namespace Microsoft.AspNet.StaticFiles
public bool LookupFileInfo() public bool LookupFileInfo()
{ {
_fileInfo = _options.FileSystem.GetFileInfo(_subPath.Value); _fileInfo = _options.FileProvider.GetFileInfo(_subPath.Value);
if (_fileInfo.Exists) if (_fileInfo.Exists)
{ {
_length = _fileInfo.Length; _length = _fileInfo.Length;

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Framework.Logging; using Microsoft.Framework.Logging;
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.StaticFiles
{ {
throw new ArgumentException(Resources.Args_NoContentTypeProvider); throw new ArgumentException(Resources.Args_NoContentTypeProvider);
} }
options.ResolveFileSystem(hostingEnv); options.ResolveFileProvider(hostingEnv);
_next = next; _next = next;
_options = options; _options = options;

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.StaticFiles namespace Microsoft.AspNet.StaticFiles

View File

@ -7,7 +7,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core; using Microsoft.AspNet.Http.Core;
using Microsoft.AspNet.TestHost; using Microsoft.AspNet.TestHost;
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.StaticFiles
public async Task NullArguments() public async Task NullArguments()
{ {
// No exception, default provided // No exception, default provided
TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions() { FileSystem = null })); TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions() { FileProvider = null }));
// PathString(null) is OK. // PathString(null) is OK.
TestServer server = TestServer.Create(app => app.UseDefaultFiles((string)null)); TestServer server = TestServer.Create(app => app.UseDefaultFiles((string)null));
@ -42,7 +42,7 @@ namespace Microsoft.AspNet.StaticFiles
app.UseDefaultFiles(new DefaultFilesOptions() app.UseDefaultFiles(new DefaultFilesOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
}); });
app.Run(context => context.Response.WriteAsync(context.Request.Path.Value)); app.Run(context => context.Response.WriteAsync(context.Request.Path.Value));
}); });
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.StaticFiles
app.UseDefaultFiles(new DefaultFilesOptions() app.UseDefaultFiles(new DefaultFilesOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
}); });
app.Run(context => context.Response.WriteAsync(context.Request.Path.Value)); app.Run(context => context.Response.WriteAsync(context.Request.Path.Value));
}); });
@ -82,7 +82,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions() TestServer server = TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl + queryString).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl + queryString).GetAsync();
@ -101,7 +101,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions() TestServer server = TestServer.Create(app => app.UseDefaultFiles(new DefaultFilesOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync();

View File

@ -7,7 +7,7 @@ using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.TestHost; using Microsoft.AspNet.TestHost;
using Xunit; using Xunit;
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.StaticFiles
Assert.Throws<ArgumentException>(() => TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() { Formatter = null }))); Assert.Throws<ArgumentException>(() => TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() { Formatter = null })));
// No exception, default provided // No exception, default provided
TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileSystem = null })); TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() { FileProvider = null }));
// PathString(null) is OK. // PathString(null) is OK.
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser((string)null)); TestServer server = TestServer.Create(app => app.UseDirectoryBrowser((string)null));
@ -41,7 +41,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync();
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
@ -58,7 +58,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync();
@ -80,7 +80,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl + queryString).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl + queryString).GetAsync();
@ -99,7 +99,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).PostAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).PostAsync();
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
@ -115,7 +115,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions() TestServer server = TestServer.Create(app => app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).SendAsync("HEAD"); HttpResponseMessage response = await server.CreateRequest(requestUrl).SendAsync("HEAD");

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core; using Microsoft.AspNet.Http.Core;
using Microsoft.Framework.Expiration.Interfaces; using Microsoft.Framework.Expiration.Interfaces;
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.StaticFiles
{ {
// Arrange // Arrange
var options = new StaticFileOptions(); var options = new StaticFileOptions();
options.FileSystem = new TestFileSystem(); options.FileProvider = new TestFileProvider();
var context = new StaticFileContext(new DefaultHttpContext(), options, PathString.Empty, NullLogger.Instance); var context = new StaticFileContext(new DefaultHttpContext(), options, PathString.Empty, NullLogger.Instance);
// Act // Act
@ -37,12 +37,12 @@ namespace Microsoft.AspNet.StaticFiles
{ {
// Arrange // Arrange
var options = new StaticFileOptions(); var options = new StaticFileOptions();
var fileSystem = new TestFileSystem(); var fileProvider = new TestFileProvider();
fileSystem.AddFile("/foo.txt", new TestFileInfo fileProvider.AddFile("/foo.txt", new TestFileInfo
{ {
LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero) LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
}); });
options.FileSystem = fileSystem; options.FileProvider = fileProvider;
var pathString = new PathString("/test"); var pathString = new PathString("/test");
var httpContext = new DefaultHttpContext(); var httpContext = new DefaultHttpContext();
httpContext.Request.Path = new PathString("/test/foo.txt"); httpContext.Request.Path = new PathString("/test/foo.txt");
@ -56,7 +56,7 @@ namespace Microsoft.AspNet.StaticFiles
Assert.True(result); Assert.True(result);
} }
private sealed class TestFileSystem : IFileSystem private sealed class TestFileProvider : IFileProvider
{ {
private readonly Dictionary<string, IFileInfo> _files = new Dictionary<string, IFileInfo>(StringComparer.Ordinal); private readonly Dictionary<string, IFileInfo> _files = new Dictionary<string, IFileInfo>(StringComparer.Ordinal);

View File

@ -7,7 +7,7 @@ using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.TestHost; using Microsoft.AspNet.TestHost;
using Xunit; using Xunit;
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.StaticFiles
Assert.Throws<ArgumentException>(() => TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() { ContentTypeProvider = null }))); Assert.Throws<ArgumentException>(() => TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() { ContentTypeProvider = null })));
// No exception, default provided // No exception, default provided
TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() { FileSystem = null })); TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() { FileProvider = null }));
// PathString(null) is OK. // PathString(null) is OK.
TestServer server = TestServer.Create(app => app.UseStaticFiles((string)null)); TestServer server = TestServer.Create(app => app.UseStaticFiles((string)null));
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync();
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
@ -58,7 +58,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).GetAsync();
@ -80,7 +80,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).PostAsync(); HttpResponseMessage response = await server.CreateRequest(requestUrl).PostAsync();
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
@ -98,7 +98,7 @@ namespace Microsoft.AspNet.StaticFiles
TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions() TestServer server = TestServer.Create(app => app.UseStaticFiles(new StaticFileOptions()
{ {
RequestPath = new PathString(baseUrl), RequestPath = new PathString(baseUrl),
FileSystem = new PhysicalFileSystem(Path.Combine(Environment.CurrentDirectory, baseDir)) FileProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, baseDir))
})); }));
HttpResponseMessage response = await server.CreateRequest(requestUrl).SendAsync("HEAD"); HttpResponseMessage response = await server.CreateRequest(requestUrl).SendAsync("HEAD");