예제 #1
0
        public void CanArrangeTest()
        {
            ChainElementArranger chain        = new ChainElementArranger();
            FieldElement         fieldElement = new FieldElement();

            //
            // No arrangers in chain
            //
            Assert.IsFalse(
                chain.CanArrange(fieldElement),
                "Empty chain element arranger should not be able to arrange an element.");

            //
            // Add an arranger that can't arrange the element
            //
            TestElementArranger disabledArranger = new TestElementArranger(false);

            chain.AddArranger(disabledArranger);
            Assert.IsFalse(chain.CanArrange(fieldElement), "Unexpected return value from CanArrange.");

            //
            // Add an arranger that can arrange the element
            //
            TestElementArranger enabledArranger = new TestElementArranger(true);

            chain.AddArranger(enabledArranger);
            Assert.IsTrue(chain.CanArrange(fieldElement), "Unexpected return value from CanArrange.");

            //
            // Null
            //
            Assert.IsFalse(chain.CanArrange(null), "Unexpected return value from CanArrange.");
        }
예제 #2
0
        public void AddArrangerNullTest()
        {
            ChainElementArranger chainArranger = new ChainElementArranger();

            Assert.Throws <ArgumentNullException>(
                delegate
            {
                chainArranger.AddArranger(null);
            });
        }
예제 #3
0
        public void UnsupportedArrangeNoParentTest()
        {
            ChainElementArranger chain        = new ChainElementArranger();
            FieldElement         fieldElement = new FieldElement();

            //
            // Add an arranger that can't arrange the element
            //
            TestElementArranger disabledArranger = new TestElementArranger(false);

            chain.AddArranger(disabledArranger);
            Assert.IsFalse(chain.CanArrange(fieldElement), "Unexpected return value from CanArrange.");

            chain.ArrangeElement(null, fieldElement);
        }
예제 #4
0
        public void UnsupportedArrangeWithParentTest()
        {
            GroupElement         parentElement = new GroupElement();
            ChainElementArranger chain         = new ChainElementArranger();
            FieldElement         fieldElement  = new FieldElement();

            //
            // Add an arranger that can't arrange the element
            //
            TestElementArranger disabledArranger = new TestElementArranger(false);

            chain.AddArranger(disabledArranger);
            Assert.IsFalse(chain.CanArrange(fieldElement), "Unexpected return value from CanArrange.");

            chain.ArrangeElement(parentElement, fieldElement);
            Assert.IsTrue(parentElement.Children.Contains(fieldElement));
        }
예제 #5
0
        public void AddArrangerNullTest()
        {
            ChainElementArranger chainArranger = new ChainElementArranger();

            chainArranger.AddArranger(null);
        }
        public void AddArrangerNullTest()
        {
            ChainElementArranger chainArranger = new ChainElementArranger();

            Assert.Throws(typeof(ArgumentNullException), () => chainArranger.AddArranger(null));
        }