public void Should_remove_child_of_stacklayout_by_using_its_UIWidget() { var child = new Entry { Placeholder = "text" }; var layout = new StackLayout(); layout.Children.Add(child); var page = new ContentPage { Content = layout }; var mgr = new DefaultSurfaceManager(); mgr.SetInspectorSurface(page); var childPair = mgr[child.Id.ToString()]; var layoutPair = mgr[layout.Id.ToString()]; Assert.IsNotEmpty(layoutPair.UIWidget.Children, "The stacklayouts UIWidget should have children."); var removed = mgr.Remove(childPair.UIWidget); Assert.IsTrue(removed, "Removed wasn't true."); Assert.IsEmpty(layout.Children, "The stacklayout has children."); Assert.IsEmpty(layoutPair.UIWidget.Children, "The stacklayout has children."); }
public void Removing_root_UIWidget() { var page = new ContentPage(); var mgr = new DefaultSurfaceManager(); var root = mgr.SetInspectorSurface(page); Assert.Throws <InvalidOperationException>(() => mgr.Remove(root)); }
public void Should_remove_only_design_surface_child_by_using_its_UIWidget() { var label = new Label { Text = "value" }; var page = new ContentPage { Content = label }; var mgr = new DefaultSurfaceManager(); var root = mgr.SetInspectorSurface(page); var labelPair = mgr[label.Id.ToString()]; var removed = mgr.Remove(labelPair.UIWidget); Assert.IsTrue(removed, "Removed wasn't true."); Assert.IsEmpty(mgr.Root.Children, "mgr.Root.Children should be empty."); Assert.IsEmpty(root.Children, "root.Children should be empty."); Assert.IsNull(page.Content, "Page content should be null."); }