Add tests for map path without wwwroot, and typos

This commit is contained in:
Pavel Krymets 2015-11-30 10:49:59 -08:00
parent 82ed1a4eee
commit f600604140
3 changed files with 13 additions and 2 deletions

View File

@ -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)
{

View File

@ -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"));
}
}
}

View File

@ -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.