public async Task SendHttpRequest()
        {

            // Arrange
            var httpRequestMessage = new HttpRequestMessage() {
                RequestUri = new Uri("http://example.com/foo")
            };

            var httpMessage = new HttpMessage()
            {
                IsRequest = true,
                HttpRequestMessage = httpRequestMessage
            };

            var consoleLogger = new ConsoleLogger();
            var fakeMessageHandler = new FakeMessageHandler();
            var httpClient = new HttpClient(fakeMessageHandler);
            httpClient.BaseAddress = new Uri("http://api.runscope.com/");

            var message = new RunscopeHttpMessageProcessor(httpClient,consoleLogger);

            // Act
            await message.ProcessHttpMessage(httpMessage);

            // Assert
            Assert.NotNull(fakeMessageHandler.LastResponseMessage);
            Assert.Equal("api.runscope.com", fakeMessageHandler.LastResponseMessage.RequestMessage.RequestUri.Host);
        }
예제 #2
0
        public async Task SendHttpRequest()
        {
            // Arrange
            var httpRequestMessage = new HttpRequestMessage()
            {
                RequestUri = new Uri("http://example.com/foo")
            };

            var httpMessage = new HttpMessage()
            {
                IsRequest          = true,
                HttpRequestMessage = httpRequestMessage
            };

            var consoleLogger      = new ConsoleLogger();
            var fakeMessageHandler = new FakeMessageHandler();

            var message = new MoesifHttpMessageProcessor(consoleLogger);

            // Act
            await message.ProcessHttpMessage(httpMessage);

            // Assert
            Assert.NotNull(fakeMessageHandler.LastResponseMessage);
            Assert.Equal("api.moesif.net", fakeMessageHandler.LastResponseMessage.RequestMessage.RequestUri.Host);
        }
        public async Task SendHttpRequest()
        {
            // Arrange
            var httpRequestMessage = new HttpRequestMessage()
            {
                RequestUri = new Uri("http://example.com/foo")
            };

            var httpMessage = new HttpMessage()
            {
                IsRequest          = true,
                HttpRequestMessage = httpRequestMessage
            };

            var consoleLogger      = new ConsoleLogger();
            var fakeMessageHandler = new FakeMessageHandler();
            var httpClient         = new HttpClient(fakeMessageHandler);

            httpClient.BaseAddress = new Uri("http://api.runscope.com/");

            var message = new RunscopeHttpMessageProcessor(httpClient, consoleLogger);

            // Act
            await message.ProcessHttpMessage(httpMessage);

            // Assert
            Assert.NotNull(fakeMessageHandler.LastResponseMessage);
            Assert.Equal("api.runscope.com", fakeMessageHandler.LastResponseMessage.RequestMessage.RequestUri.Host);
        }