Пример #1
0
        public void Calling_Contains_should_return_true_when_xenwidget_is_a_descendant_of_root()
        {
            var label = new Label();
            var child = new Entry {
                Placeholder = "text"
            };
            var layout = new StackLayout();

            layout.Children.Add(child);
            var page = new ContentPage {
                Content = layout
            };

            var mgr = new XamarinDesignSurfaceManager();

            mgr.SetDesignSurface(page);

            var childPair      = mgr[child.Id.ToString()];
            var containsWidget = mgr.Contains(childPair.XenWidget);
            var containsVisual = mgr.Contains(childPair.VisualElement);
            var containsLabel  = mgr.Contains(label);

            Assert.IsTrue(containsWidget, "XenWidget not found.");
            Assert.IsTrue(containsVisual, "VisualElement not found.");
            Assert.IsFalse(containsLabel, "Label was not added to the page.");
        }