Ejemplo n.º 1
0
        public static void Run()
        {
            var configuration = new HttpCallConfiguration{
                ServiceUri = serviceUri, 
                Method = HttpMethod.POST,
                Iterations = iterations, 
                IntervalMilliseconds = intervalMilliseconds, 
                PostData = soapEnvelope};

            configuration.Headers.Add("SOAPAction", action);
            var client = new RawHttpClient(configuration, Console.Out);

            client.MakeRawHttpCall();
        }
Ejemplo n.º 2
0
        public static void Run()
        {
            var configuration = new HttpCallConfiguration {
                ServiceUri           = serviceUri,
                Method               = HttpMethod.POST,
                Iterations           = iterations,
                IntervalMilliseconds = intervalMilliseconds,
                PostData             = soapEnvelope
            };

            configuration.Headers.Add("SOAPAction", action);
            var client = new RawHttpClient(configuration, Console.Out);

            client.MakeRawHttpCall();
        }
        /// <summary>
        /// Make sure the TestHttpHandler is running before trying this test.
        /// </summary>
        public static void Call_TestHttpHandler()
        {
            var configuration = new HttpCallConfiguration
            {
                ServiceUri = serviceUri,
                Method = HttpMethod.GET,
                Iterations = iterations,
                IntervalMilliseconds = intervalMilliseconds,
                PrintResponse = false,
                Expect100Continue = false,
                UseNagleAlgorithm = false,
                KeepAlive = true
            };

            var client = new RawHttpClient(configuration, Console.Out);

            client.MakeRawHttpCall();
        }
        public async Task Delete_Request_Calls_Correct_Url_WithoutBody()
        {
            HttpCallConfiguration config = new HttpCallConfiguration()
            {
                HttpMethod = "DELETE",
                MediaType  = "application/json",
                Url        = "http://www.example.com/webhook"
            };

            HttpCallAttribute attr = new HttpCallAttribute()
            {
            };

            HttpRequestMessage message = null;
            var httpMessageHandler     = new HttpMessageHandlerMock()
                                         .SetupHandler(req =>
            {
                message = req;
                return(new HttpResponseMessage(HttpStatusCode.OK));
            });

            var httpClient = new HttpClient(httpMessageHandler);

            var httpClientFactory = new Mock <IHttpClientFactory>();

            httpClientFactory.Setup(x => x.Create()).Returns(httpClient);

            var target = new HttpCallMessageAsyncCollector(config, attr, httpClientFactory.Object);

            await target.AddAsync(new HttpCallMessage()
            {
                Body = "{ type: 'test' }"
            });

            await target.FlushAsync();


            httpClientFactory.VerifyAll();

            Assert.NotNull(message);
            Assert.Equal("http://www.example.com/webhook", message.RequestUri.ToString());
            Assert.Equal(HttpMethod.Delete, message.Method);
            Assert.Null(message.Content);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Make sure the TestTimerService is running before trying this test.
        /// </summary>
        public static void Call_TestTimerService()
        {
            var configuration = new HttpCallConfiguration
            {
                ServiceUri = serviceUri,
                Method = HttpMethod.POST,
                Iterations = iterations,
                IntervalMilliseconds = intervalMilliseconds,
                PostData = soapEnvelope,
                PrintResponse = false,
                Expect100Continue = false,
                UseNagleAlgorithm = false,
                KeepAlive = true
            };

            configuration.Headers.Add("SOAPAction", action);
            var client = new RawHttpClient(configuration, Console.Out);

            client.MakeRawHttpCall();
        }