Update test
This commit is contained in:
parent
f5c8bf09e2
commit
83ea8051c8
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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>>();
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue