Exemplo n.º 1
0
        public void Added_Child_Should_Have_VisualParent_Set()
        {
            var target = new TestVisual();
            var child  = new Visual();

            target.AddChild(child);

            Assert.Equal(target, child.GetVisualParent());
        }
Exemplo n.º 2
0
        public void Removed_Child_Should_Have_VisualParent_Cleared()
        {
            var target = new TestVisual();
            var child  = new Visual();

            target.AddChild(child);
            target.RemoveChild(child);

            Assert.Null(child.GetVisualParent());
        }
Exemplo n.º 3
0
        public void Added_Child_Should_Notify_VisualParent_Changed()
        {
            var target  = new TestVisual();
            var child   = new TestVisual();
            var parents = new List <IVisual>();

            child.GetObservable(Visual.VisualParentProperty).Subscribe(x => parents.Add(x));
            target.AddChild(child);
            target.RemoveChild(child);

            Assert.Equal(new IVisual[] { null, target, null }, parents);
        }