Пример #1
0
        public void RemoveComponents2()
        {
            IComposable container = new ComposableDefault();

            container.RemoveComponents(typeof(TestComponent));
            Assert.IsTrue(container.CountComponents == 0);
        }
Пример #2
0
        public void RemoveGenericComponents2()
        {
            IComposable container = new ComposableDefault();

            container.RemoveComponents <TestComponent>();
            Assert.IsTrue(container.CountComponents == 0);
        }
Пример #3
0
        public void GetGenericComponents6()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent[] components = container.GetComponents <TestComponent>();
            Assert.IsTrue(components.Length == 0);
        }
Пример #4
0
        public void AddComponents()
        {
            IComposable container = new ComposableDefault();

            container.AddComponents(new TestComponent());

            Assert.IsTrue(container.CountComponents == 1);
        }
Пример #5
0
        public void RemoveGenericComponent5()
        {
            IComposable container = new ComposableDefault(
                new TestUpdatableComponent()
                );

            container.RemoveComponent <TestComponent>();
            Assert.IsTrue(container.CountComponents == 1);
        }
Пример #6
0
        public void RemoveGenericComponentInterface1()
        {
            IComposable container = new ComposableDefault(
                new TestUpdatableComponent()
                );

            container.RemoveComponent <IUpdatable>();
            Assert.IsTrue(container.CountComponents == 0);
        }
Пример #7
0
        public void GetComponentInterface2()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component = container.GetComponent(typeof(IComponent));

            Assert.AreEqual(addedComponent, component);
        }
Пример #8
0
        public void GetComponentNested()
        {
            IComponent  addedComponent = new TestNestedComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component = container.GetComponent(typeof(TestComponent));

            Assert.AreEqual(addedComponent, component);
        }
Пример #9
0
        public void GetGenericComponentInterface1()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component = container.GetComponent <IUpdatable>() as IComponent;

            Assert.AreEqual(addedComponent, component);
        }
Пример #10
0
        public void GetGenericComponent()
        {
            IComponent  addedComponent = new TestComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component = container.GetComponent <TestComponent>();

            Assert.AreEqual(addedComponent, component);
        }
Пример #11
0
        public void ContainsGenericComponentInterface1()
        {
            IComposable container = new ComposableDefault(
                new TestUpdatableComponent()
                );

            bool result = container.ContainsComponent <IUpdatable>();

            Assert.IsTrue(result);
        }
Пример #12
0
        public void RemoveComponent2()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent()
                );

            container.RemoveComponent(typeof(TestComponent));
            Assert.IsTrue(container.CountComponents == 1);
        }
Пример #13
0
        public void ContainsComponentNested()
        {
            IComposable container = new ComposableDefault(
                new TestNestedComponent()
                );

            bool result = container.ContainsComponent(typeof(TestComponent));

            Assert.IsTrue(result);
        }
Пример #14
0
        public void RemoveGenericComponent4()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestNestedComponent()
                );

            container.RemoveComponent <IUpdatable>();
            Assert.IsTrue(container.CountComponents == 2);
        }
Пример #15
0
        public void ContainsGenericComponent2()
        {
            IComposable container = new ComposableDefault(
                new TestUpdatableComponent()
                );

            bool result = container.ContainsComponent <TestComponent>();

            Assert.IsTrue(result == false);
        }
Пример #16
0
        public void ContainsComponentInterface2()
        {
            IComposable container = new ComposableDefault(
                new TestComponent()
                );

            bool result = container.ContainsComponent(typeof(IUpdatable));

            Assert.IsTrue(result == false);
        }
Пример #17
0
        public void ContainsComponents3()
        {
            IComposable container = new ComposableDefault(
                new TestComponent()
                );

            bool result = container.ContainsComponents(typeof(IComponent), typeof(TestUpdatableComponent));

            Assert.IsTrue(result == false);
        }
Пример #18
0
        public void GetComponents5()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2
                );

            IComponent[] components = container.GetComponents(typeof(IUpdatable));
            Assert.IsTrue(components.Length == 0);
        }
Пример #19
0
        public void RemoveGenericComponentsInterface2()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent(),
                new TestNestedComponent()
                );

            container.RemoveComponents <IComponent>();
            Assert.IsTrue(container.CountComponents == 0);
        }
Пример #20
0
        public void RemoveComponentsInterface1()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent(),
                new TestNestedComponent()
                );

            container.RemoveComponents(typeof(IUpdatable));
            Assert.IsTrue(container.CountComponents == 2);
        }
Пример #21
0
        public void GetGenericComponents4()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2
                );

            IUpdatable[] updatables = container.GetComponents <IUpdatable>();
            Assert.IsTrue(updatables.Length == 0);
        }
Пример #22
0
        public void TryGetGenericComponentInterface2()
        {
            IComponent  addedComponent = new TestComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IUpdatable updatable;
            bool       result = container.TryGetComponent <IUpdatable>(out updatable);

            Assert.IsTrue(result == false);
            Assert.IsNull(updatable);
        }
Пример #23
0
        public void RemoveGenericComponentInterfaceDestroyable()
        {
            var         component = new TestDestroyableComponent();
            IComposable container = new ComposableDefault(component);

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

            Assert.IsTrue(container.CountComponents == 0);
            Assert.IsTrue(component.Destroyed);
        }
Пример #24
0
        public void TryGetComponentInterface2()
        {
            IComponent  addedComponent = new TestComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component;
            bool       result = container.TryGetComponent(typeof(IUpdatable), out component);

            Assert.IsTrue(result == false);
            Assert.IsNull(component);
        }
Пример #25
0
        public void TryGetGenericComponent2()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            TestComponent component;
            bool          result = container.TryGetComponent <TestComponent>(out component);

            Assert.IsTrue(result == false);
            Assert.IsNull(component);
        }
Пример #26
0
        public void RemoveGenericComponentNested2()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent(),
                new TestNestedComponent()
                );

            // Remove one first component
            container.RemoveComponent <TestComponent>();
            Assert.IsTrue(container.CountComponents == 2);
        }
Пример #27
0
        public void GetGenericComponents3()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestUpdatableComponent();
            IComponent  addedComponent3 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2, addedComponent3
                );

            IComponent[] components = container.GetComponents <TestComponent>();
            Assert.IsTrue(components.Length == 2);
        }
Пример #28
0
        public void RemoveComponentInterface3()
        {
            IComposable container = new ComposableDefault(
                new TestComponent(),
                new TestUpdatableComponent(),
                new TestNestedComponent()
                );

            // Remove one first component
            container.RemoveComponent(typeof(IComponent));
            Assert.IsTrue(container.CountComponents == 2);
        }
Пример #29
0
        public void TryGetComponentInterface1()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            IComponent component;
            bool       result = container.TryGetComponent(typeof(IUpdatable), out component);

            Assert.IsTrue(result);
            Assert.IsNotNull(component);
            Assert.AreEqual(addedComponent, component);
        }
Пример #30
0
        public void TryGetGenericComponentNested()
        {
            IComponent  addedComponent = new TestNestedComponent();
            IComposable container      = new ComposableDefault(addedComponent);

            TestComponent component;
            bool          result = container.TryGetComponent <TestComponent>(out component);

            Assert.IsTrue(result);
            Assert.IsNotNull(component);
            Assert.AreEqual(addedComponent, component);
        }