示例#1
0
        private async Task TestLogEntryExitAsync(ILoggedAsyncMock target)
        {
            await target.ShortAsync();

            Assert.AreEqual(2, logList.Logs.Count);
            Assert.AreEqual(LogLevel.Trace, logList.Logs[0].GetLevel());
            Assert.AreEqual(LogLevel.Trace, logList.Logs[1].GetLevel());
        }
示例#2
0
        private async Task TestLogEntryExceptionAsync(ILoggedAsyncMock target)
        {
            bool caughtException = false;

            try
            {
                await target.ThrowSomethingAsync();
            }
            catch (ApplicationException)
            {
                caughtException = true;
            }

            Assert.IsTrue(caughtException);

            Assert.AreEqual(2, logList.Logs.Count);
            Assert.AreEqual(LogLevel.Trace, logList.Logs[0].GetLevel());
            Assert.AreEqual(LogLevel.Error, logList.Logs[1].GetLevel());
        }