Exemple #1
0
        private LogMessageV1[] ExtractLogMessages(Parameters args)
        {
            var result = new List <LogMessageV1>();

            foreach (var parameters in args.GetAsParameters("messages").Values)
            {
                var message = ExtractLogMessage(AnyValueMap.FromValue(parameters));

                result.Add(message);
            }

            return(result.ToArray());
        }
        public void TestGetAsString()
        {
            var message = AnyValueMap.FromTuples(
                "key1", 123,
                "key2", "ABC"
                );

            var restoredMessageObject = JsonConverter.FromJson <object>(JsonConverter.ToJson(message));
            var restoredMessage       = AnyValueMap.FromValue(restoredMessageObject);

            Assert.Equal(2, restoredMessage.Count);
            Assert.Equal(123, restoredMessage.GetAsInteger("key1"));
            Assert.Equal("ABC", restoredMessage.GetAsString("key2"));
        }