Extension methods are not good for testing (that\'s described here: Mocking Extension Methods with Moq, http://www.clariusconsulting.net/blogs/kzu/archive/2009/12/22/Howtomo
Guess, I found most appropriate solution for test: It is not necessary to mock unity container and check if 'log' object was taken from it. I will just make a mock for 'Log' object, register its object instance in the container and check in test if this log object is really used.
This will do what is required.
Mock mockLog = new Mock();
mockLog.Setup(mock=>mock.Id).Returns(TestLogId);
IUnityContainer container = new UnityContainer();
container
.RegisterInstance(mockCommandExecutionLog.Object)
...
;
...
mockLog.Verify(
mock => mock.Id,
Times.Once(),
"It seems like 'Log' object is not used"
);
Thanks.