This repository was archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fixes #3928] Ensure we throw at UseMvc during application startup if…
… AddMvc wasn't called
- Loading branch information
Showing
8 changed files
with
53 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
src/Microsoft.AspNet.Mvc.Core/Internal/MvcServicesHelper.cs
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/Microsoft.AspNet.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNet.Builder; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Microsoft.AspNet.Mvc.Core.Builder | ||
{ | ||
public class MvcApplicationBuilderExtensionsTest | ||
{ | ||
[Fact] | ||
public void UseMvc_ThrowsInvalidOperationException_IfRoutingMarkerServiceIsNotRegistered() | ||
{ | ||
// Arrange | ||
var applicationBuilderMock = new Mock<IApplicationBuilder>(); | ||
applicationBuilderMock | ||
.Setup(s => s.ApplicationServices) | ||
.Returns(Mock.Of<IServiceProvider>()); | ||
|
||
// Act & Assert | ||
var exception = Assert.Throws<InvalidOperationException>( | ||
() => applicationBuilderMock.Object.UseMvc(rb => { })); | ||
|
||
Assert.Equal( | ||
"Unable to find the required services. Please add all the required services by calling " + | ||
"'IServiceCollection.AddMvc' or 'IServiceCollection.AddMvcCore' inside the call to " + | ||
"'ConfigureServices(...)' in the application startup code.", | ||
exception.Message); | ||
} | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
test/Microsoft.AspNet.Mvc.Core.Test/Internal/MvcServicesHelperTests.cs
This file was deleted.
Oops, something went wrong.