static TagCollection CutOutCorrelationId(TagCollection tags) { // tags.Count > 0 Assert.Greater(tags.Count, 0); Assert.IsTrue(tags.ContainsKey(CorrelationIdName)); return(TagCollection.FromIEnumerable(tags.Where(_ => _.Key != CorrelationIdName))); }
static void AssertTagsAreEqual(TagCollection expected, TagCollection actual) { Assert.AreEqual(expected.Count, actual.Count); foreach (var expectedTag in expected) { Assert.IsTrue(actual.ContainsKey(expectedTag.Key)); var expectedValue = expectedTag.Value; var actualValue = actual[expectedTag.Key]; Assert.AreEqual(expectedValue, actualValue); } }
/// <summary> /// Returns true if <see cref="NotContainsTagFilter.Key" /> is not present in <paramref name="collection" /> or <paramref name="collection" /> is null. /// </summary> public bool Matches(TagCollection collection) => collection == null || !collection.ContainsKey(Key);
/// <summary> /// Returns true if <see cref="ContainsTagFilter.Key" /> is present in <paramref name="collection" />. /// </summary> public bool Matches(TagCollection collection) => collection != null && collection.ContainsKey(Key);