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."); }
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); }
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)); }