public void Serialises_to_JSON_string_with_correct_settings()
        {
            var message = new GelfMessage
            {
                Level            = SyslogSeverity.Emergency,
                AdditionalFields = new Dictionary <string, object>()
            };

            var messageJson = message.ToJson();

            Assert.Contains("version", messageJson);
            Assert.DoesNotContain("Emergency", messageJson);
            Assert.DoesNotContain(Environment.NewLine, messageJson);
            Assert.DoesNotContain("null", messageJson);
        }
Ejemplo n.º 2
0
        public void Serialises_to_JSON_string_with_correct_settings()
        {
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                Converters =
                {
                    new StringEnumConverter()
                }
            };

            var message = new GelfMessage
            {
                Level            = SyslogSeverity.Emergency,
                AdditionalFields = new Dictionary <string, object>()
            };

            var messageJson = message.ToJson();

            Assert.DoesNotContain("Emergency", messageJson);
            Assert.DoesNotContain(Environment.NewLine, messageJson);
            Assert.DoesNotContain("null", messageJson);
        }