зеркало из https://github.com/dotnet/aspnetcore.git
Use a fake clock in the test (#36625)
This commit is contained in:
Родитель
a18ae25f9f
Коммит
d0465d864e
|
@ -285,7 +285,11 @@ namespace Microsoft.AspNetCore.Identity.Test
|
|||
var services = new ServiceCollection();
|
||||
services.AddSingleton(options.Object);
|
||||
services.AddSingleton(signInManager.Object);
|
||||
var clock = new SystemClock();
|
||||
var clock = new TestClock()
|
||||
{
|
||||
// Second precision
|
||||
UtcNow = new DateTimeOffset(2013, 6, 11, 12, 34, 56, 0, TimeSpan.Zero)
|
||||
};
|
||||
services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager.Object, clock, new LoggerFactory()));
|
||||
httpContext.Setup(c => c.RequestServices).Returns(services.BuildServiceProvider());
|
||||
var id = new ClaimsIdentity(IdentityConstants.ApplicationScheme);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
||||
namespace Microsoft.AspNetCore.Identity.InMemory
|
||||
namespace Microsoft.AspNetCore.Identity.Test
|
||||
{
|
||||
public class TestClock : ISystemClock
|
||||
{
|
Загрузка…
Ссылка в новой задаче