This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding option to configure services when exposing the ASP.NET 5 pipel…
…ine via OWIN #398
- Loading branch information
Showing
3 changed files
with
64 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// 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.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNet.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
|
||
|
||
namespace Microsoft.AspNet.Owin | ||
{ | ||
using CreateMiddleware = Func< | ||
Func<IDictionary<string, object>, Task>, | ||
Func<IDictionary<string, object>, Task> | ||
>; | ||
using AddMiddleware = Action<Func< | ||
Func<IDictionary<string, object>, Task>, | ||
Func<IDictionary<string, object>, Task> | ||
>>; | ||
|
||
public class OwinExtensionTests | ||
{ | ||
[Fact] | ||
public void OwinConfigureServicesAddsServices() | ||
{ | ||
AddMiddleware build = new List<CreateMiddleware>().Add; | ||
IServiceProvider serviceProvider = null; | ||
|
||
var builder = build.UseBuilder(applicationBuilder => | ||
{ | ||
serviceProvider = applicationBuilder.ApplicationServices; | ||
} | ||
, serviceCollection => | ||
{ | ||
serviceCollection.AddInstance(new FakeService()); | ||
}); | ||
|
||
Assert.NotNull(serviceProvider); | ||
} | ||
|
||
public class FakeService | ||
{ | ||
|
||
} | ||
} | ||
} |