Пример #1
0
        public void RemoveGenericComponentInterfaceActivable()
        {
            var component = new TestActivableComponent();

            component.Enable();
            IComposable container = new ComposableDefault(component);

            // Disable in component
            container.RemoveComponent <IActivable>();

            Assert.IsTrue(container.CountComponents == 0);
            Assert.IsTrue(component.Enabled == false);
        }
Пример #2
0
        public void RemoveComponents()
        {
            var activableComponent = new TestActivableComponent();

            activableComponent.Enable();
            var destroyableComponent = new TestDestroyableComponent();

            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent(),
                new TestNestedComponent(),
                activableComponent,
                destroyableComponent
                );

            container.RemoveComponents();
            Assert.IsTrue(container.CountComponents == 0);
            Assert.IsTrue(activableComponent.Enabled == false);
            Assert.IsTrue(destroyableComponent.Destroyed);
        }