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);
        }
예제 #2
0
        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());
        }
예제 #3
0
        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());
        }