Exemplo n.º 1
0
        public async Task SendsSingleMessageToInputApi()
        {
            var message = new LogglyMessage {
                Content = "Test1", CustomTags = { new SimpleTag {
                                                      Value = "TestTag"
                                                  } }
            };

            var response = await _transport.Send(new[] { message });

            Assert.AreEqual("https://test/inputs/MyLogglyToken", _requestUri.ToString());

            Assert.AreEqual("myTag,TestTag", _tags);

            Assert.AreEqual("Test1", _requestContent);

            Assert.AreEqual(ResponseCode.Success, response.Code);
        }
        public async Task ForwardedForIpIsAddedCorrectly(string ipValueToForward, string expectedIpInHeader)
        {
            //set this before creating the transport
            LogglyConfig.Instance.Transport.ForwardedForIp = ipValueToForward;
            _transport = new HttpMessageTransport(_handler.Object);

            var message = new LogglyMessage {
                Content = "Test1"
            };
            await _transport.Send(new[] { message });

            Assert.AreEqual(expectedIpInHeader, _ipHeader);
        }