示例#1
0
        public void Can_Flatten_Array_EventData()
        {
            var logger = new EventLogger("test", innerLogger);

            var eventData = new
            {
                Foo = new[] { 1, 2, 3 },
                Bar = new
                {
                    Baz = new[] { 42 }
                }
            };

            logger.InfoEvent("event", eventData);

            AssertShouldContainProperty("Foo[0]", 1);
            AssertShouldContainProperty("Foo[1]", 2);
            AssertShouldContainProperty("Foo[2]", 3);
            AssertShouldContainProperty("Bar.Baz[0]", 42);
        }
示例#2
0
        public void Can_Flatten_Deep_Anon_EventData()
        {
            var logger = new EventLogger("test", innerLogger);

            var eventData = new
            {
                Foo = "foo",
                Bar = 42,
                Baz = new
                {
                    Quux = "bazquux"
                }
            };

            logger.InfoEvent("event", eventData);

            AssertShouldContainProperty("Foo", "foo");
            AssertShouldContainProperty("Bar", 42);
            AssertShouldContainProperty("Baz.Quux", "bazquux");
        }