public void StructureMapResolver_should_not_dispose_container() { var mockContainer = new Mock <IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); mockContainer.Verify(c => c.Dispose(), Times.Never, "Should not have called Dispose on the container."); }
public void StructureMapResolver_should_throw_when_attempting_to_get_service_after_being_disposed() { var mockContainer = new Mock <IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); Assert.That(() => resolver.GetService(typeof(IContactRepository)), Throws.Exception.TypeOf <ObjectDisposedException>()); }
public void StructureMapResolver_should_throw_when_attempting_to_get_service_after_being_disposed() { var mockContainer = new Mock<IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); Assert.That(() => resolver.GetService(typeof (IContactRepository)), Throws.Exception.TypeOf<ObjectDisposedException>()); }
public static void ShutDown() { StructureMapResolver.Dispose(); RootContainer.Dispose(); }
public void StructureMapResolver_should_not_dispose_container() { var mockContainer = new Mock<IContainer>(); var resolver = new StructureMapResolver(mockContainer.Object); resolver.Dispose(); mockContainer.Verify(c => c.Dispose(), Times.Never, "Should not have called Dispose on the container."); }