Пример #1
0
        public void GetGenericComponents6()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

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

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

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

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

            Assert.AreEqual(addedComponent, component);
        }
Пример #4
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);
        }
Пример #5
0
        public void TryGetComponent3()
        {
            IComponent  addedComponent = new TestUpdatableComponent();
            IComposable container      = new ComposableDefault(addedComponent);

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

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

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

            Assert.IsTrue(result);
            Assert.IsNotNull(updatable);
            Assert.AreEqual(addedComponent, updatable);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
0
        public void GetComponents2()
        {
            IComponent  addedComponent1 = new TestComponent();
            IComponent  addedComponent2 = new TestUpdatableComponent();
            IComponent  addedComponent3 = new TestNestedComponent();
            IComposable container       = new ComposableDefault(
                addedComponent1, addedComponent2, addedComponent3
                );

            IComponent[] components = container.GetComponents(typeof(IComponent));
            Assert.IsTrue(components.Length == 3);
        }
Пример #10
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]);
        }