public EventHandler(int _screenWidth, int _screenHeight, int _minRadius, int _maxRadius) { screenHeight = _screenHeight; screenWidth = _screenWidth; minRadius = _minRadius; maxRadius = _maxRadius; patternCache = new PatternCache(CACHE_MAX_LENGTH, CACHE_FILLUP_THRESHOD, new PatternCache.StartDownloadingPatternsUntilFillup(StartDownloadingPatternsUntilFillup)); viewCollection = new ViewCollection(); myHttpClient = new MyHttpClient(); surfaceViewRefresher = new SurfaceViewRefresher(); }
public async Task Fact1() { ServiceCollection services = new ServiceCollection(); ConfigureLoggers(services); services.Configure <MyHttpClientOptions>(o => { o.BaseAddress = options.BaseAddress; }); services.AddHttpClient <IMyHttpClient, MyHttpClient>().ConfigureHttpMessageHandlerBuilder(builder => { if (options.CallTestService) { webApplicationFactory.CreateDefaultClient(); builder.PrimaryHandler = webApplicationFactory.Server.CreateHandler(); } }); using (ServiceProvider serviceProvider = services.BuildServiceProvider()) { ILogger <UnitTest1> logger = serviceProvider.GetRequiredService <ILogger <UnitTest1> >(); var scope = new { requestId = "my-request-id", context = new { correlationId = "1234", someOtherData = "bla" } }; Dictionary <string, object> correlationContext = new Dictionary <string, object>() { { nameof(scope.context.correlationId), scope.context.correlationId }, { nameof(scope.context.someOtherData), scope.context.someOtherData }, }; using (logger.BeginScope(scope)) { HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, "/WeatherForecast") { Headers = { { "Correlation-Context", correlationContext.Select(FormattedPair) }, { "Request-Id", scope.requestId } } }; IMyHttpClient myHttpClient1 = serviceProvider.GetService <IMyHttpClient>(); HttpResponseMessage response = await myHttpClient1.Client.SendAsync(httpRequestMessage); Assert.True(response.IsSuccessStatusCode); } } }
public MyEventHandler(int _screenWidth, int _screenHeight, int _minRadius, int _maxRadius, SurfaceViewRefresh _surfaceViewRefresh) { surfaceViewRefresh = _surfaceViewRefresh; screenHeight = _screenHeight; screenWidth = _screenWidth; minRadius = _minRadius; maxRadius = _maxRadius; patternCache = new PatternCache(CACHE_MAX_LENGTH, CACHE_FILLUP_THRESHOD, new PatternCache.StartDownloadingPatternsUntilFillup(StartDownloadingPatternsUntilFillup)); //patternCache = new PatternCacheTest(); viewCollection = new ViewCollection(); myHttpClient = new MyHttpClient(); StartDownloadingPatternsUntilFillup(DPatternType.Color); StartDownloadingPatternsUntilFillup(DPatternType.Image); }
public SeatMonitoringApiClient(string host, IMyHttpClient httpClient) { Host = host; HttpClient = httpClient; }
public ValuesController(IMyHttpClient client) { this.client = client; }