public void ThrowManualFlushWithBypass() { var outputMock = new Mock <IDirectOutput>(); var flushMock = new Mock <IRecordFlusher>(); var serpent = new SerpentKernel.Kernel(flushMock.Object, outputMock.Object); var newEntry = new SerpentEntry(String.Empty); serpent.ForceFlushOnRecord = true; Assert.Throws <InvalidFlushOperationException>(() => serpent.FlushRecords()); }
public void PassFlushWithoutBypass() { var outputMock = new Mock <IDirectOutput>(); var flushMock = new Mock <IRecordFlusher>(); var serpent = new SerpentKernel.Kernel(flushMock.Object, outputMock.Object); var newEntry = new SerpentEntry(String.Empty); serpent.ForceFlushOnRecord = false; serpent.Record(newEntry); Assert.NotEmpty(serpent.GetRecords()); serpent.FlushRecords(); Assert.Empty(serpent.GetRecords()); flushMock.Verify(x => x.FlushSingleEntry(It.IsAny <ISerpentEntry>()), Times.Never); }