Esempio n. 1
0
        public void DescendantAddedExistingChildren()
        {
            var root = new TestElement();

            var tier2 = new TestElement();

            var child = new TestElement
            {
                Children =
                {
                    tier2
                }
            };

            bool tier1added = false;
            bool tier2added = false;

            root.DescendantAdded += (sender, args) =>
            {
                if (!tier1added)
                {
                    tier1added = ReferenceEquals(child, args.Element);
                }
                if (!tier2added)
                {
                    tier2added = ReferenceEquals(tier2, args.Element);
                }
            };

            root.Children.Add(child);

            Assert.That(tier1added, Is.True);
            Assert.That(tier2added, Is.True);
        }
Esempio n. 2
0
		public void DescendantAddedExistingChildren ()
		{
			var root = new TestElement();

			var tier2 = new TestElement();

			var child = new TestElement {
				Children = {
					tier2
				}
			};

			bool tier1added = false;
			bool tier2added = false;
			root.DescendantAdded += (sender, args) => {
				if (!tier1added)
					tier1added = ReferenceEquals (child, args.Element);
				if (!tier2added)
					tier2added = ReferenceEquals (tier2, args.Element);
			};

			root.Children.Add (child);

			Assert.That (tier1added, Is.True);
			Assert.That (tier2added, Is.True);
		}
Esempio n. 3
0
		public void DescendantAddedLevel1 ()
		{
			var root = new TestElement();

			var child = new TestElement();

			bool added = false;
			root.DescendantAdded += (sender, args) => {
				Assert.That (args.Element, Is.SameAs (child));
				added = true;
			};

			root.Children.Add (child);
		}
Esempio n. 4
0
        public void DescendantAddedLevel1()
        {
            var root = new TestElement();

            var child = new TestElement();

            bool added = false;

            root.DescendantAdded += (sender, args) => {
                Assert.That(args.Element, Is.SameAs(child));
                added = true;
            };

            root.Children.Add(child);
        }
Esempio n. 5
0
        public void DescendantRemovedLevel2()
        {
            var root = new TestElement();

            var child = new TestElement();

            root.Children.Add(child);

            var child2 = new TestElement();

            child.Children.Add(child2);

            bool removed = false;

            root.DescendantRemoved += (sender, args) => {
                Assert.That(args.Element, Is.SameAs(child2));
                removed = true;
            };

            child.Children.Remove(child2);
        }
Esempio n. 6
0
		public void DescendantRemovedLevel2 ()
		{
			var root = new TestElement();

			var child = new TestElement();
			root.Children.Add (child);

			var child2 = new TestElement();
			child.Children.Add (child2);

			bool removed = false;
			root.DescendantRemoved += (sender, args) => {
				Assert.That (args.Element, Is.SameAs (child2));
				removed = true;
			};

			child.Children.Remove (child2);
		}