public void TraceListenerFilterOnMultipleCollectionsWithCommonElementsDoesNotRepeatElements() { TraceListenerFilter filter = new TraceListenerFilter(); TraceListener listener1 = new MockTraceListener(); TraceListener listener2 = new MockTraceListener(); IList traceListenersCollection1 = new TraceListener[] { listener1, listener2 }; TraceListener listener3 = new MockTraceListener(); TraceListener listener4 = new MockTraceListener(); IList traceListenersCollection2 = new TraceListener[] { listener2, listener3, listener4 }; int i = 0; Dictionary<TraceListener, int> listeners = new Dictionary<TraceListener, int>(); foreach (TraceListener listener in filter.GetAvailableTraceListeners(traceListenersCollection1)) { i++; listeners[listener] = (listeners.ContainsKey(listener) ? listeners[listener] : 0) + 1; } foreach (TraceListener listener in filter.GetAvailableTraceListeners(traceListenersCollection2)) { i++; listeners[listener] = (listeners.ContainsKey(listener) ? listeners[listener] : 0) + 1; } Assert.AreEqual(4, i); Assert.AreEqual(1, listeners[listener1]); Assert.AreEqual(1, listeners[listener2]); Assert.AreEqual(1, listeners[listener3]); Assert.AreEqual(1, listeners[listener4]); }
public void TraceListenerFilterOnSingleElementCollectionReturnsHasSingleElement() { TraceListenerFilter filter = new TraceListenerFilter(); TraceListener listener1 = new MockTraceListener(); IList traceListenersCollection = new TraceListener[] { listener1 }; int i = 0; Dictionary<TraceListener, int> listeners = new Dictionary<TraceListener, int>(); foreach (TraceListener listener in filter.GetAvailableTraceListeners(traceListenersCollection)) { i++; listeners[listener] = (listeners.ContainsKey(listener) ? listeners[listener] : 0) + 1; } Assert.AreEqual(1, i); Assert.AreEqual(1, listeners[listener1]); }
public void SetUp() { proxy = new EntLibLoggingProxyTraceListener(); Logger.SetLogWriter(new LogWriterFactory().Create(), false); MockTraceListener.Reset(); }
public void SetUp() { proxy = new EntLibLoggingProxyTraceListener(); MockTraceListener.Reset(); }