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 ThrowOnInvalidSeverityRange() { 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.MinimumSeverity = EntrySeverity.Critical; serpent.MaximumSeverity = EntrySeverity.Low; Assert.Throws <InvalidSeverityRangeException>(() => serpent.Record(newEntry)); }
public void PassRecordWhenSeverityIsMaximum() { 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, EntrySeverity.Critical); serpent.MaximumSeverity = EntrySeverity.Critical; serpent.Record(newEntry); Assert.NotEmpty(serpent.GetRecords()); }
public void FailRecordWhenSeverityLowerThanMinimum() { 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, EntrySeverity.Medium); serpent.MinimumSeverity = EntrySeverity.High; serpent.Record(newEntry); Assert.Empty(serpent.GetRecords()); }
public void PassFlushWithBypass() { 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; serpent.Record(newEntry); flushMock.Verify(x => x.FlushSingleEntry(It.IsAny <ISerpentEntry>())); }
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); }