public CustomAuthenticationHandlerTests() { var fixtureCustomizations = new AutoMoqCustomization { ConfigureMembers = true }; _fixture = new Fixture().Customize(fixtureCustomizations); AllowFixtureCircularDependencies(); _vesoAuthServiceMock = _fixture.Freeze <Mock <IAuthService> >(); _optionsMonitorMock = _fixture.Freeze <Mock <IOptionsMonitor <AuthenticationSchemeOptions> > >(); _clockMock = _fixture.Freeze <Mock <ISystemClock> >(); _serviceProviderMock = _fixture.Freeze <Mock <IServiceProvider> >(); _authenticationServiceMock = _fixture.Freeze <Mock <IAuthenticationService> >(); _fixture.Register <ILoggerFactory>(() => new NullLoggerFactory()); _urlEncoder = UrlEncoder.Default; _serviceProviderMock.Setup(s => s.GetService(typeof(IAuthenticationService))) .Returns(_authenticationServiceMock.Object); _optionsMonitorMock.Setup(o => o.Get(It.IsAny <string>())) .Returns(new AuthenticationSchemeOptions { ForwardAuthenticate = null }); _context = new DefaultHttpContext { RequestServices = _serviceProviderMock.Object }; _scheme = new AuthenticationScheme( _fixture.Create <string>(), null, typeof(CustomAuthenticationHandler)); _sut = _fixture.Create <CustomAuthenticationHandler>(); _sut.InitializeAsync(_scheme, _context).Wait(); }