Exemplo n.º 1
0
        public void GetComponentNested()
        {
            IComponent  addedComponent = new TestNestedComponent();
            IComposable container      = new ComposableDefault(addedComponent);

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

            Assert.AreEqual(addedComponent, component);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void GetGenericComponents2()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestUpdatableComponent();
            IComponent  addedComponent3 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2, addedComponent3
                );

            IUpdatable[] updatables = container.GetComponents <IUpdatable>();
            Assert.IsTrue(updatables.Length == 1);
            Assert.AreEqual(addedComponent2, updatables[0]);
        }
Exemplo n.º 7
0
        public void GetComponents3()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestUpdatableComponent();
            IComponent  addedComponent3 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2, addedComponent3
                );

            IComponent[] components = container.GetComponents(typeof(IUpdatable));
            Assert.IsTrue(components.Length == 1);
            Assert.AreEqual(addedComponent2, components[0]);
        }