Add tests for map path without wwwroot, and typos
This commit is contained in:
parent
82ed1a4eee
commit
f600604140
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Hosting
|
|||
}
|
||||
if (string.IsNullOrEmpty(hostingEnvironment.WebRootPath))
|
||||
{
|
||||
throw new InvalidOperationException("Can not map path because webroot path is not set");
|
||||
throw new InvalidOperationException("Cannot map path because webroot path is not set");
|
||||
}
|
||||
if (virtualPath == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.FileProviders;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
|
|
@ -67,5 +68,15 @@ namespace Microsoft.AspNet.Hosting.Tests
|
|||
Assert.Equal("NewName", env.EnvironmentName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MapPathThrowsWithNoWwwroot()
|
||||
{
|
||||
var env = new HostingEnvironment();
|
||||
|
||||
env.Initialize(".", new WebHostOptions(), null);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => env.MapPath("file.txt"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
This file is here to keep directories needed by tests. Do no remove it.
|
||||
This file is here to keep directories needed by tests. Do not remove it.
|
||||
Loading…
Reference in New Issue