コード例 #1
0
        public int GetLogEntries_SetsLogEntries(int pageSize, int noOfLogEntries)
        {
            InMemoryLogger.ClearLog();

            var logger = new InMemoryLogger();

            for (var i = 0; i < noOfLogEntries; i++)
            {
                logger.ErrorFormat("abc {0}", i);
            }

            var result = new InMemoryLoggerLogEntryReader().GetLogEntries(1, pageSize);

            return(result.LogEntries.Count);
        }
コード例 #2
0
        public void ErrorFormat_LogMaxNumberOfLogEntries_EntriesEnqueuedToLog()
        {
            InMemoryLogger.ClearLog();

            var log = new InMemoryLogger();

            for (var i = 0; i <= 1001; i++)
            {
                log.ErrorFormat("abc: {0}", i);
            }

            Assert.That(InMemoryLogger.Log.Count, Is.EqualTo(1000));
            Assert.That(InMemoryLogger.Log[0].Message, Is.EqualTo("abc: 1001"));
            Assert.That(InMemoryLogger.Log[999].Message, Is.EqualTo("abc: 2"));
        }
コード例 #3
0
        public void GetLogEntries_InMemoryLogIsNotEmpty_ReturnsNotEmptyResult()
        {
            InMemoryLogger.ClearLog();

            var logger = new InMemoryLogger();

            logger.ErrorFormat("abc {0}", 1);

            var logEntryReader = new InMemoryLoggerLogEntryReader();

            var result = logEntryReader.GetLogEntries(1, 10);

            Assert.That(result.PageCount, Is.EqualTo(1));
            Assert.That(result.LogEntries, Is.Not.Empty);
        }