Exemplo n.º 1
0
        public void TestPerform()
        {
            TestComposite root = new TestComposite();

            for (int i = 0; i < 10; i++)
            {
                root.Add(new TestComposite());
            }

            Assert.AreEqual(10, root.Perform());
        }
Exemplo n.º 2
0
        public void TestAddAndRemove2()
        {
            TestComposite root = new TestComposite();
            TestComposite element = new TestComposite();

            bool exceptionOccured = false;

            root.Add(element);
            root.Remove(element);

            // element not in root, so remove should cause an exception
            try
            {
                root.Remove(element);
            }
            catch (ArgumentException)
            {
                exceptionOccured = true;
            }

            Assert.IsTrue(exceptionOccured);
        }