示例#1
0
        public void AddOverridableAttributeWhichIsNotAvailable()
        {
            EventPayloadBuilder builder = new EventPayloadBuilder(new Dictionary <string, JsonValue>(), mockLogger);

            builder.AddOverridableAttribute("Overridable", JsonStringValue.FromString("Changed"));

            Assert.That(builder.Build(), Is.EqualTo("{\"Overridable\":\"Changed\"}"));
        }
示例#2
0
        public void AddOverridableAttributeWhichIsAlreadyAvailable()
        {
            Dictionary <string, JsonValue> dict = new Dictionary <string, JsonValue>();

            dict.Add("timestamp", JsonStringValue.FromString("Changed"));

            EventPayloadBuilder builder = new EventPayloadBuilder(dict, mockLogger);

            builder.AddOverridableAttribute("timestamp", JsonStringValue.FromString("ComingFromAgent"));

            Assert.That(builder.Build(), Is.EqualTo("{\"timestamp\":\"Changed\",\"dt.overridden_keys\":[\"timestamp\"]}"));
        }
示例#3
0
        public void AddNonOverridableAttributeWhichIsAlreadyAvailable()
        {
            Dictionary <string, JsonValue> dict = new Dictionary <string, JsonValue>();

            dict.Add("dt.sid", JsonStringValue.FromString("MySession"));

            EventPayloadBuilder builder = new EventPayloadBuilder(dict, mockLogger);

            builder.AddNonOverridableAttribute("dt.sid", JsonStringValue.FromString("ComingFromAgent"));

            Assert.That(builder.Build(), Is.EqualTo("{\"dt.sid\":\"ComingFromAgent\"}"));
        }
示例#4
0
        public void RemovingReservedValuesAtInitializing()
        {
            Dictionary <string, JsonValue> dict = new Dictionary <string, JsonValue>();

            dict.Add("dt", JsonStringValue.FromString("Removed"));
            dict.Add("dt.hello", JsonStringValue.FromString("Removed"));
            dict.Add("dt.type", JsonStringValue.FromString("Okay"));

            EventPayloadBuilder builder = new EventPayloadBuilder(dict, mockLogger);

            Assert.That(builder.Build(), Is.EqualTo("{\"dt.type\":\"Okay\"}"));
        }
示例#5
0
        public void CreateEmptyPayloadBuilderWithNullAttributes()
        {
            EventPayloadBuilder builder = new EventPayloadBuilder(null, mockLogger);

            Assert.That(builder.Build(), Is.EqualTo("{}"));
        }
示例#6
0
        public void CreateEmptyPayloadBuilder()
        {
            EventPayloadBuilder builder = new EventPayloadBuilder(new Dictionary <string, JsonValue>(), mockLogger);

            Assert.That(builder.Build(), Is.EqualTo("{}"));
        }