public void Init() { LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider()); // white space between unit tests LogProvider.GetLogger("").Debug("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); LogProvider.GetLogger("").Debug("UNIT TEST: " + TestContext.TestName); LogProvider.GetLogger("").Debug("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); server = TestServer.Create(app => { appBuilder = app; var factory = TestFactory.Create(); mockUserService = new Mock <InMemoryUserService>(TestUsers.Get()); mockUserService.CallBase = true; factory.UserService = Registration.RegisterFactory <IUserService>(() => mockUserService.Object); options = TestIdentityServerOptions.Create(); options.Factory = factory; options.AuthenticationOptions.IdentityProviders = OverrideIdentityProviderConfiguration ?? ConfigureAdditionalIdentityProviders; protector = options.DataProtector; app.UseIdentityServer(options); ticketFormatter = new Microsoft.Owin.Security.DataHandler.TicketDataFormat( new DataProtectorAdapter(protector, options.AuthenticationOptions.CookieOptions.Prefix + Constants.PartialSignInAuthenticationType)); }); client = server.HttpClient; }
protected void Init() { clients = TestClients.Get(); var clientStore = new InMemoryClientStore(clients); var scopeStore = new InMemoryScopeStore(TestScopes.Get()); var factory = new IdentityServerServiceFactory { ScopeStore = Registration.RegisterFactory <IScopeStore>(() => scopeStore), ClientStore = Registration.RegisterFactory <IClientStore>(() => clientStore) }; server = TestServer.Create(app => { appBuilder = app; mockUserService = new Mock <InMemoryUserService>(TestUsers.Get()); mockUserService.CallBase = true; factory.UserService = Registration.RegisterFactory <IUserService>(() => mockUserService.Object); options = TestIdentityServerOptions.Create(); options.Factory = factory; options.AuthenticationOptions.IdentityProviders = OverrideIdentityProviderConfiguration ?? ConfigureAdditionalIdentityProviders; protector = options.DataProtector; app.UseIdentityServer(options); ticketFormatter = new TicketDataFormat( new DataProtectorAdapter(protector, options.AuthenticationOptions.CookieOptions.Prefix + Constants.PartialSignInAuthenticationType)); }); client = server.HttpClient; }
public void Init() { LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider()); // white space between unit tests LogProvider.GetLogger("").Debug("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); LogProvider.GetLogger("").Debug("UNIT TEST: " + TestContext.TestName); LogProvider.GetLogger("").Debug("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); server = TestServer.Create(app => { var factory = TestFactory.Create(); mockUserService = new Mock <InMemoryUserService>(TestUsers.Get()); mockUserService.CallBase = true; factory.UserService = Registration.RegisterFactory <IUserService>(() => mockUserService.Object); options = TestIdentityServerOptions.Create(); options.Factory = factory; options.AdditionalIdentityProviderConfiguration = ConfigureAdditionalIdentityProviders; protector = options.DataProtector; app.UseIdentityServer(options); }); client = server.HttpClient; }