예제 #1
0
 public void FailSomethingTest()
 {
     try {
         _decorated.FailSomething(new { aap = "noot" });
         Assert.Fail("Expected exception");
     } catch (Exception e) {
         AssertLog("FailSomething called", $"FailSomething threw {e.GetType()}");
     }
 }
        public void FailSomethingTest()
        {
            Exception exception = null;

            try {
                _decorated.FailSomething(new { aap = "noot" });
            } catch (Exception e) {
                exception = e;
            }
            Assert.AreEqual(2, _log.Count);
            Assert.AreEqual("Calling FailSomething({\"aap\":\"noot\"}).", _log.Dequeue().Message);
            var testLogEntry = _log.Dequeue();

            Assert.AreEqual(LogLevel.Warning, testLogEntry.LogLevel);
            Assert.AreEqual("Exception FormatException: o o o from FailSomething({\"aap\":\"noot\"}).", testLogEntry.Message);
        }