public void setup_scenario_base() { RequestId = Guid.NewGuid().ToString(); CorrelationId = Guid.NewGuid().ToString(); SessionId = Guid.NewGuid().ToString(); Service = "theService"; Version = "1.2.3-server"; StubInboundRequestIdAccessor = new StubInboundRequestIdAccessor { Response = RequestId }; StubCorrelationIdAccessor = new StubCorrelationIdAccessor { Response = CorrelationId }; StubSessionIdAccessor = new StubSessionIdAccessor { Response = SessionId }; StubApplicationInfo = new StubApplicationInfo { Name = Service, Version = Version }; StubHttpServerEventCallback = new StubHttpServerEventCallback(); var identifyingCallback = new IdentifyingHttpServerEventCallback(StubSessionIdAccessor, StubCorrelationIdAccessor, StubInboundRequestIdAccessor, StubApplicationInfo); TestHost = new LightweightHttpApiHost(services => { services.AddDefaultServices(); services.AddSingleton <ICircuitBreakerManager, StubCircuitBreakerManager>(); services.AddSingleton <IApplicationInfo>(StubApplicationInfo); services.AddSingleton <IInboundRequestIdAccessor>(StubInboundRequestIdAccessor); services.AddSingleton <ICorrelationIdAccessor>(StubCorrelationIdAccessor); services.AddSingleton <ISessionIdAccessor>(StubSessionIdAccessor); services.AddSingleton <IHttpServerEventCallback>(identifyingCallback); services.AddSingleton <IHttpServerEventCallback>(StubHttpServerEventCallback); }, Configure); }
private static IdentifyingHttpServerEventCallback CreateIdentifyingCallback(IServiceProvider serviceProvider) { var inboundRequestIdAccessor = serviceProvider.GetService <IInboundRequestIdAccessor>(); var correlationIdAccessor = serviceProvider.GetService <ICorrelationIdAccessor>(); var sessionIdAccessor = serviceProvider.GetService <ISessionIdAccessor>(); var applicationInfo = serviceProvider.GetService <IApplicationInfo>(); var identifyingCallback = new IdentifyingHttpServerEventCallback(sessionIdAccessor, correlationIdAccessor, inboundRequestIdAccessor, applicationInfo); return(identifyingCallback); }