public IDictionary <string, object> GetByType(SpanEventAttributeType attributeType)
        {
            IDictionary <string, object> attributes;

            switch (attributeType)
            {
            case SpanEventAttributeType.Intrinsic:
                attributes = IntrinsicAttributes;
                break;

            case SpanEventAttributeType.Agent:
                attributes = AgentAttributes;
                break;

            case SpanEventAttributeType.User:
                attributes = UserAttributes;
                break;

            default:
                throw new NotImplementedException();
            }

            return(attributes ?? new Dictionary <string, object>());
        }
        public static void SpanEventDoesNotHaveAttributes(IEnumerable <string> unexpectedAttributes, SpanEventAttributeType attributeType, SpanEvent spanEvent)
        {
            var succeeded        = true;
            var builder          = new StringBuilder();
            var actualAttributes = spanEvent.GetByType(attributeType);

            foreach (var unexpectedAttribute in unexpectedAttributes)
            {
                if (actualAttributes.ContainsKey(unexpectedAttribute))
                {
                    builder.AppendFormat("Attribute named {0} was found in the span event but it should not have been.", unexpectedAttribute);
                    builder.AppendLine();
                    succeeded = false;
                }
            }

            Assert.True(succeeded, builder.ToString());
        }
        public static void SpanEventHasAttributes(IEnumerable <string> expectedAttributes, SpanEventAttributeType attributeType, SpanEvent spanEvent)
        {
            var succeeded        = true;
            var builder          = new StringBuilder();
            var actualAttributes = spanEvent.GetByType(attributeType);

            foreach (var expectedAttribute in expectedAttributes)
            {
                if (!actualAttributes.ContainsKey(expectedAttribute))
                {
                    builder.AppendFormat("Attribute named {0} was not found in the span event.", expectedAttribute);
                    builder.AppendLine();
                    succeeded = false;
                }
            }

            Assert.True(succeeded, builder.ToString());
        }