Beispiel #1
0
        public void BacktraceMetricsUniqueEvent_ShouldUpdateTimeStamp_UniqueEventIsUpdated()
        {
            const int nextTime             = 1000;
            var       timestamp            = DateTimeHelper.Timestamp();
            var       expectedNewTimestamp = timestamp + nextTime;
            var       attributes           = _attributeProvider.GenerateAttributes();

            var uniqueEvent = new UniqueEvent(UniqueAttributeName, timestamp, attributes);

            uniqueEvent.UpdateTimestamp(expectedNewTimestamp, attributes);

            Assert.AreEqual(expectedNewTimestamp, uniqueEvent.Timestamp);
        }
Beispiel #2
0
        public void BacktraceMetricsUniqueEvent_ShouldPreventFromUpdatingAttributeWhenUniqueAttributeDoesntExist_UniqueEventIsUpdated()
        {
            const int    nextTime             = 1000;
            const string uniqueEventName      = "BacktraceMetricsUniqueEvent_ShouldPreventFromUpdatingAttributeWhenUniqueAttributeDoesntExist_UniqueEventIsUpdated";
            var          timestamp            = DateTimeHelper.Timestamp();
            var          expectedNewTimestamp = timestamp + nextTime;

            var uniqueEvent = new UniqueEvent(uniqueEventName, timestamp, new Dictionary <string, string> {
                { uniqueEventName, uniqueEventName }
            });

            uniqueEvent.UpdateTimestamp(expectedNewTimestamp, null);

            Assert.AreEqual(uniqueEventName, uniqueEvent.Attributes[uniqueEventName]);
        }
Beispiel #3
0
        public void BacktraceMetricsUniqueEvent_ShouldUpdateAttributes_UniqueEventIsUpdated()
        {
            const int    nextTime             = 1000;
            const string newAttributeName     = "foo";
            var          timestamp            = DateTimeHelper.Timestamp();
            var          expectedNewTimestamp = timestamp + nextTime;
            var          attributes           = _attributeProvider.GenerateAttributes();


            var uniqueEvent = new UniqueEvent(UniqueAttributeName, timestamp, attributes);

            _attributeProvider[newAttributeName] = newAttributeName;
            uniqueEvent.UpdateTimestamp(expectedNewTimestamp, _attributeProvider.GenerateAttributes());

            Assert.AreEqual(newAttributeName, uniqueEvent.Attributes[newAttributeName]);
        }
Beispiel #4
0
        public void BacktraceMetricsUniqueEvent_ShouldPreventFromUpdatingAttributeWhenUniqueAttributeValueIsEmpty_UniqueEventIsUpdated()
        {
            const int    nextTime             = 1000;
            const string uniqueEventName      = "BacktraceMetricsUniqueEvent_ShouldPreventFromUpdatingAttributeWhenUniqueAttributeValueIsEmpty_UniqueEventIsUpdated";
            var          attributeProvider    = new AttributeProvider();
            var          timestamp            = DateTimeHelper.Timestamp();
            var          expectedNewTimestamp = timestamp + nextTime;

            attributeProvider[uniqueEventName] = uniqueEventName;
            var attributes = attributeProvider.GenerateAttributes();

            var uniqueEvent = new UniqueEvent(uniqueEventName, timestamp, attributes);

            attributeProvider[uniqueEventName] = string.Empty;

            uniqueEvent.UpdateTimestamp(expectedNewTimestamp, attributeProvider.GenerateAttributes());

            Assert.AreEqual(uniqueEventName, uniqueEvent.Attributes[uniqueEventName]);
        }