Update test

This commit is contained in:
Hao Kung 2015-09-02 15:44:39 -07:00
parent f5c8bf09e2
commit 83ea8051c8
3 changed files with 5 additions and 6 deletions

View File

@ -22,7 +22,7 @@ namespace AntiforgerySample
{ {
_next = next; _next = next;
_antiforgery = antiforgery; _antiforgery = antiforgery;
_options = options.Options; _options = options.Value;
} }
public async Task Invoke(HttpContext context) public async Task Invoke(HttpContext context)

View File

@ -36,14 +36,13 @@ namespace Microsoft.AspNet.Antiforgery
{ {
// Arrange // Arrange
var serviceCollection = new ServiceCollection(); var serviceCollection = new ServiceCollection();
serviceCollection.AddAntiforgery();
serviceCollection.ConfigureDataProtection(o => o.SetApplicationName("HelloWorldApp"));
serviceCollection.Configure<AntiforgeryOptions>(o => serviceCollection.Configure<AntiforgeryOptions>(o =>
{ {
Assert.Null(o.CookieName); Assert.Null(o.CookieName);
o.CookieName = "antiforgery"; o.CookieName = "antiforgery";
}, order: 9999); });
serviceCollection.AddAntiforgery();
serviceCollection.ConfigureDataProtection(o => o.SetApplicationName("HelloWorldApp"));
var services = serviceCollection.BuildServiceProvider(); var services = serviceCollection.BuildServiceProvider();
var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>(); var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Antiforgery
public TestOptionsManager(AntiforgeryOptions options) public TestOptionsManager(AntiforgeryOptions options)
{ {
Options = options; Value = options;
} }
public AntiforgeryOptions Value { get; set; } = new AntiforgeryOptions(); public AntiforgeryOptions Value { get; set; } = new AntiforgeryOptions();