var logRepository = new Mock<ILogRepository>();
logRepository.Setup(x => x.Write(It.IsAny<Exception>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Verifiable();
In this case, we are using the Verifiable to ensure that it runs.
We could also use a callback here:
logRepository.Setup(x => x.Write(It.IsAny<Exception>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Callback<Exception, string, string, string, string, string>((ex, caller, user, machine, source, message) => { Console.WriteLine(message); });
this would log the output from the method to standard output on the console (many testing frameworks let you capture that output into their runner)