public void WithTagContext() { Assert.Empty(TagsTestUtil.TagContextToList(tagger.CurrentTagContext)); var scopedTags = tagger.EmptyBuilder.Put(KEY_1, VALUE_1).Build(); var scope = tagger.WithTagContext(scopedTags); try { Assert.Same(scopedTags, tagger.CurrentTagContext); } finally { scope.Dispose(); } Assert.Empty(TagsTestUtil.TagContextToList(tagger.CurrentTagContext)); }
public void NoopTagger() { ITagger noopTagger = NoopTags.NoopTagger; Assert.Same(NoopTags.NoopTagContext, noopTagger.Empty); Assert.Same(NoopTags.NoopTagContext, noopTagger.CurrentTagContext); Assert.Same(NoopTags.NoopTagContextBuilder, noopTagger.EmptyBuilder); Assert.Same(NoopTags.NoopTagContextBuilder, noopTagger.ToBuilder(TAG_CONTEXT)); Assert.Same(NoopTags.NoopTagContextBuilder, noopTagger.CurrentBuilder); Assert.Same(NoopScope.Instance, noopTagger.WithTagContext(TAG_CONTEXT)); }
public void NoopTagger_WithTagContext_DisallowsNull() { ITagger noopTagger = NoopTags.NoopTagger; Assert.Throws <ArgumentNullException>(() => noopTagger.WithTagContext(null)); }