/// <summary> /// Flushes the accumulated messages to the superseded log writer. /// </summary> public void FlushAccumulatedMessages() { Debug.Assert(_accumulator != null); if (_accumulator != null) { _accumulator.Flush(); } }
public void FlushTest() { var supersededWriter = new TestLogWriter(); LogAccumulator.DisposalCallback disposalCallback = null; LogAccumulator target = new LogAccumulator(supersededWriter, disposalCallback); string message = "Hello"; target.WriteLine(message); target.Flush(); var expected = message + "$n"; var actual = supersededWriter.Output.ToString().Replace(Environment.NewLine, "$n"); Assert.AreEqual(expected, actual, "(Note: $n replaces new line characters)"); PrivateObject privateObj = new PrivateObject(target); Assert.AreEqual("", privateObj.GetFieldOrProperty("accumulatedMessages").ToString()); }