I'm getting a code analysis warning on some of my unit tests:
WidgetManagerTests.cs (40): CA2000 : Microsoft.Reliability : In method 'WidgetManagerTests.TestInitialize()', call System.IDisposable.Dispose on object 'new ContainerControlledLifetimeManager()' before all references to it are out of scope.
I'm using Unity and Moq, this is the offending line:
var loggingServiceMock = new Mock<ILoggingService>();
this.unityContainer.RegisterInstance<ILoggingService>(loggingServiceMock.Object, new ContainerControlledLifetimeManager());