Ejemplo n.º 1
0
        public void Equals_DoesNotIgnoreDuplicateTags()
        {
            var ctx1 = new SimpleTagContext(TAG1);
            var ctx2 = new SimpleTagContext(TAG1, TAG1);

            Assert.True(ctx1.Equals(ctx1));
            Assert.True(ctx2.Equals(ctx2));
            Assert.False(ctx1.Equals(ctx2));
        }
Ejemplo n.º 2
0
        public void CurrentBuilder_SkipNullTag()
        {
            ITagContext        tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
            ITagContextBuilder result = GetResultOfCurrentBuilder(tagContextWithNullTag);

            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2
            }, TagsTestUtil.TagContextToList(result.Build()));
        }
Ejemplo n.º 3
0
        public void WithTagContext_SkipNullTag()
        {
            ITagContext tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
            ITagContext result = GetResultOfWithTagContext(tagContextWithNullTag);

            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 4
0
        public void Equals_HandlesNullIterator()
        {
            var ctx1 = new SimpleTagContext((IEnumerable <Tag>)null);
            var ctx2 = new SimpleTagContext((IEnumerable <Tag>)null);
            var ctx3 = new SimpleTagContext();

            Assert.True(ctx1.Equals(ctx2));
            Assert.True(ctx1.Equals(ctx3));
            Assert.True(ctx2.Equals(ctx3));
        }
Ejemplo n.º 5
0
        public void GetCurrentTagContext_SkipNullTag()
        {
            ITagContext tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
            var         result = GetResultOfGetCurrentTagContext(tagContextWithNullTag);

            Assert.Equal(new List <DistributedContextEntry>()
            {
                TAG1, TAG2
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 6
0
        public void ToBuilder_SkipNullTag()
        {
            ITagContext tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
            ITagContext newTagContext         = tagger.ToBuilder(tagContextWithNullTag).Build();

            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2
            }, TagsTestUtil.TagContextToList(newTagContext));
        }
Ejemplo n.º 7
0
        public void ToBuilder_ConvertUnknownTagContextToTagContext()
        {
            ITagContext unknownTagContext = new SimpleTagContext(TAG1, TAG2, TAG3);
            ITagContext newTagContext     = tagger.ToBuilder(unknownTagContext).Build();

            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2, TAG3
            }, TagsTestUtil.TagContextToList(newTagContext));
            Assert.IsType <TagContext>(newTagContext);
        }
Ejemplo n.º 8
0
        public void GetCurrentTagContext_ConvertUnknownTagContextToTagContext()
        {
            ITagContext unknownTagContext = new SimpleTagContext(TAG1, TAG2, TAG3);
            var         result            = GetResultOfGetCurrentTagContext(unknownTagContext);

            Assert.IsType <TagContext>(result);
            Assert.Equal(new List <DistributedContextEntry>()
            {
                TAG1, TAG2, TAG3
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 9
0
        public void WithTagContext_ConvertUnknownTagContextToTagContext()
        {
            ITagContext unknownTagContext = new SimpleTagContext(TAG1, TAG2, TAG3);
            ITagContext result            = GetResultOfWithTagContext(unknownTagContext);

            Assert.IsType <TagContext>(result);
            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2, TAG3
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 10
0
        public void CurrentBuilder()
        {
            ITagContext        tags   = new SimpleTagContext(TAG1, TAG2, TAG3);
            ITagContextBuilder result = GetResultOfCurrentBuilder(tags);

            Assert.IsType <TagContextBuilder>(result);
            Assert.Equal(new List <ITag>()
            {
                TAG1, TAG2, TAG3
            }, TagsTestUtil.TagContextToList(result.Build()));
        }
Ejemplo n.º 11
0
        public void ToBuilder_RemoveDuplicatesFromUnknownTagContext()
        {
            ITag        tag1 = Tag.Create(K1, V1);
            ITag        tag2 = Tag.Create(K1, V2);
            ITagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            ITagContext newTagContext = tagger.ToBuilder(tagContextWithDuplicateTags).Build();

            Assert.Equal(new List <ITag>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(newTagContext));
        }
Ejemplo n.º 12
0
        public void CurrentBuilder_RemoveDuplicateTags()
        {
            var         tag1 = new DistributedContextEntry(K1, V1);
            var         tag2 = new DistributedContextEntry(K1, V2);
            ITagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            var         result = GetResultOfCurrentBuilder(tagContextWithDuplicateTags);

            Assert.Equal(new List <DistributedContextEntry>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(result.Build()));
        }
Ejemplo n.º 13
0
        public void WithTagContext_RemoveDuplicatesFromUnknownTagContext()
        {
            var         tag1 = new DistributedContextEntry(K1, V1);
            var         tag2 = new DistributedContextEntry(K1, V2);
            ITagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            var         result = GetResultOfWithTagContext(tagContextWithDuplicateTags);

            Assert.Equal(new List <DistributedContextEntry>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 14
0
        public void CurrentBuilder_RemoveDuplicateTags()
        {
            ITag               tag1 = Tag.Create(K1, V1);
            ITag               tag2 = Tag.Create(K1, V2);
            ITagContext        tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            ITagContextBuilder result = GetResultOfCurrentBuilder(tagContextWithDuplicateTags);

            Assert.Equal(new List <ITag>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(result.Build()));
        }
Ejemplo n.º 15
0
        public void ToBuilder_RemoveDuplicatesFromUnknownTagContext()
        {
            var         tag1 = new DistributedContextEntry(K1, V1);
            var         tag2 = new DistributedContextEntry(K1, V2);
            ITagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            var         newTagContext = tagger.ToBuilder(tagContextWithDuplicateTags).Build();

            Assert.Equal(new List <DistributedContextEntry>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(newTagContext));
        }
Ejemplo n.º 16
0
        public void WithTagContext_RemoveDuplicatesFromUnknownTagContext()
        {
            ITag        tag1 = Tag.Create(K1, V1);
            ITag        tag2 = Tag.Create(K1, V2);
            ITagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
            ITagContext result = GetResultOfWithTagContext(tagContextWithDuplicateTags);

            Assert.Equal(new List <ITag>()
            {
                tag2
            }, TagsTestUtil.TagContextToList(result));
        }
Ejemplo n.º 17
0
        public void Equals_IgnoresTagOrderAndTagContextClass()
        {
            var ctx1 = new SimpleTagContext(TAG1, TAG2);
            var ctx2 = new SimpleTagContext(TAG1, TAG2);
            var ctx3 = new SimpleTagContext(TAG2, TAG1);
            var ctx4 = new TestTagContext();

            Assert.True(ctx1.Equals(ctx2));
            Assert.True(ctx1.Equals(ctx3));
            Assert.True(ctx1.Equals(ctx4));
            Assert.True(ctx2.Equals(ctx3));
            Assert.True(ctx2.Equals(ctx4));
            Assert.True(ctx3.Equals(ctx4));
        }
Ejemplo n.º 18
0
        public void Equals_DoesNotIgnoreNullTags()
        {
            var ctx1 = new SimpleTagContext(TAG1);
            var ctx2 = new SimpleTagContext(TAG1, null);
            var ctx3 = new SimpleTagContext(null, TAG1);
            var ctx4 = new SimpleTagContext(TAG1, null, null);

            Assert.True(ctx2.Equals(ctx3));
            Assert.False(ctx1.Equals(ctx2));
            Assert.False(ctx1.Equals(ctx3));
            Assert.False(ctx1.Equals(ctx4));
            Assert.False(ctx2.Equals(ctx4));
            Assert.False(ctx3.Equals(ctx4));
        }