예제 #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());
        }
예제 #2
0
        public void TestAddAndRemove1()
        {
            TestComposite root = new TestComposite();
            TestComposite element = new TestComposite();

            bool exceptionOccured = false;

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

            Assert.IsTrue(exceptionOccured);
        }