Ejemplo n.º 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\"}"));
        }
Ejemplo n.º 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\"]}"));
        }
Ejemplo n.º 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\"}"));
        }
Ejemplo n.º 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\"}"));
        }
Ejemplo n.º 5
0
        public void CreateEmptyPayloadBuilderWithNullAttributes()
        {
            EventPayloadBuilder builder = new EventPayloadBuilder(null, mockLogger);

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

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