public void DisposingContainerCausesContainedObjectsToBeTornDown() { TestableRootCompositionContainer cc = new TestableRootCompositionContainer(); MockTearDownStrategy strategy = new MockTearDownStrategy(); cc.Builder.Strategies.Add(strategy, WCSFBuilderStage.PreCreation); cc.Dispose(); Assert.IsTrue(strategy.TearDownCalled); }
public void TestServicesAreTornDownWhenContainerIsDisposed() { TestableRootCompositionContainer container = new TestableRootCompositionContainer(); MockService svc = container.Services.AddNew<MockService>(); container.Dispose(); Assert.IsTrue(svc.OnTearingDownCalled); }
public void ChildContainerAreDisposedWithParent() { TestableRootCompositionContainer parent = new TestableRootCompositionContainer(); CompositionContainer child = parent.Containers.AddNew<CompositionContainer>(); MockService svc = child.Services.AddNew<MockService>(); parent.Dispose(); Assert.IsTrue(svc.OnTearingDownCalled); }