public void MergeCombinesSourcesAndFilters() { var leftSubs = new[] { new EventProviderSubscription(ProviderOne.Write, EventLevel.Warning), new EventProviderSubscription(InternalLogger.Write, EventLevel.Warning, 0xdead0000) }; var leftFilters = new[] { "abc", "123" }; var leftConfig = new LogConfiguration("foo", LogType.Console, leftSubs, leftFilters); var rightSubs = new[] { new EventProviderSubscription(InternalLogger.Write, EventLevel.Informational, 0xbeef), new EventProviderSubscription(ProviderTwo.Write, EventLevel.Verbose) }; var rightFilters = new[] { "def", "123" }; var rightConfig = new LogConfiguration("foo", LogType.Console, rightSubs, rightFilters); leftConfig.Merge(rightConfig); Assert.AreEqual(3, leftConfig.Filters.Count()); Assert.Contains("abc", leftConfig.Filters.ToList()); Assert.Contains("def", leftConfig.Filters.ToList()); Assert.Contains("123", leftConfig.Filters.ToList()); Assert.AreEqual(3, leftConfig.Subscriptions.Count()); foreach (var sub in leftConfig.Subscriptions) { if (sub.Source == ProviderOne.Write) { Assert.AreEqual(EventLevel.Warning, sub.MinimumLevel); Assert.AreEqual(0, (ulong)sub.Keywords); } else if (sub.Source == ProviderTwo.Write) { Assert.AreEqual(EventLevel.Verbose, sub.MinimumLevel); Assert.AreEqual(0, (ulong)sub.Keywords); } else if (sub.Source == InternalLogger.Write) { Assert.AreEqual(EventLevel.Informational, sub.MinimumLevel); Assert.AreEqual(0xdeadbeef, (ulong)sub.Keywords); } else { Assert.Fail("unexpected provider."); } } }