public void Cleans_Before_Appending() { var logEvent = new LoggingEvent(new LoggingEventData()); Mock <ISelfCleaningRollingFileAppender>().Setup(x => x.AppendBase(It.IsAny <LoggingEvent>())) .Callback(() => Mock <ILogCleaner>().Verify(x => x.TryCleanup(), Times.Once)); TestObject.Append(logEvent); Mock <ISelfCleaningRollingFileAppender>().Verify(x => x.AppendBase(logEvent)); Mock <ISelfCleaningRollingFileAppender>().Verify(x => x.AppendBase(It.IsAny <LoggingEvent>()), Times.Once); Mock <ILogCleaner>().Verify(x => x.TryCleanup(), Times.Once); }