public void FuncWithParameterCreatesLogEvents() { MockMembers.Calculate .Log(this) .ReturnOnce(15) .Throw(p => new Exception("Beep - wrong!")); var _ = Members.Calculate(13, 21); var ex = Assert.Throws <Exception>(() => Members.Calculate(14, 22)); Assert.Equal(4, LogEvents.Count); Assert.Equal(LogEventLevel.Debug, LogEvents[0].Level); Assert.Equal(@"Calling [MockMembers] IMembers.Calculate with parameter: ""(13, 21)""", LogEvents[0].RenderMessage()); Assert.Equal(LogEventLevel.Debug, LogEvents[1].Level); Assert.Equal(@"Returned from [MockMembers] IMembers.Calculate with result: 15", LogEvents[1].RenderMessage()); Assert.Equal(LogEventLevel.Debug, LogEvents[2].Level); Assert.Equal(@"Calling [MockMembers] IMembers.Calculate with parameter: ""(14, 22)""", LogEvents[2].RenderMessage()); Assert.Equal(LogEventLevel.Error, LogEvents[3].Level); Assert.Equal(@"Call to [MockMembers] IMembers.Calculate threw exception ""Beep - wrong!""", LogEvents[3].RenderMessage()); Assert.Same(ex, LogEvents[3].Exception); }