Exemplo n.º 1
0
        internal CallingServerClient CreateMockCallingServerClient(int responseCode, object?responseContent = null, HttpHeader[]?httpHeaders = null)
        {
            var mockResponse = new MockResponse(responseCode);

            if (responseContent != null)
            {
                if (responseContent is string responseContentString)
                {
                    mockResponse.SetContent(responseContentString);
                }
                else if (responseContent is byte[] responseContentObjectArr)
                {
                    mockResponse.SetContent(responseContentObjectArr);
                }
            }

            if (httpHeaders != null)
            {
                for (int i = 0; i < httpHeaders.Length; i++)
                {
                    mockResponse.AddHeader(httpHeaders[i]);
                }
            }

            var callingServerClientOptions = new CallingServerClientOptions
            {
                Transport = new MockTransport(mockResponse)
            };

            return(new CallingServerClient(connectionString, callingServerClientOptions));
        }
Exemplo n.º 2
0
        private CallingServerClientOptions CreateServerCallingClientOptionsWithCorrelationVectorLogs()
        {
            CallingServerClientOptions callClientOptions = new CallingServerClientOptions();

            callClientOptions.Diagnostics.LoggedHeaderNames.Add("MS-CV");
            return(InstrumentClientOptions(callClientOptions));
        }
Exemplo n.º 3
0
        internal CallingServerClient CreateMockCallingServerClient(params MockResponse[] mockResponses)
        {
            var callingServerClientOptions = new CallingServerClientOptions
            {
                Transport = new MockTransport(mockResponses)
            };

            return(new CallingServerClient(connectionString, callingServerClientOptions));
        }