public void Add_child_appends_view_to_children() { var layout = new TestLayout(); var child1 = new TestView(); var child2 = new TestView(); layout.Add(child1); layout.Add(child2); layout.Children.Should().BeEquivalentSequenceTo(child1, child2); }
public void Adding_null_child_throws_exception() { var layout = new TestLayout(); Action addNullChild = () => layout.Add(null); addNullChild.Should().Throw <ArgumentNullException>(); }
public void Child_added_to_layout_registers_for_updated() { var layout = new TestLayout(); var view = new TestView(); layout.Add(view); view.RaiseUpdated(); layout.OnChildUpdatedInvocationCount.Should().Be(1); }
public void Removing_child_from_layout_unregisters_for_updated() { var layout = new TestLayout(); var view = new TestView(); layout.Add(view); layout.Remove(view); view.RaiseUpdated(); layout.OnChildUpdatedInvocationCount.Should().Be(0); layout.Children.Should().BeEmpty(); }
public void Clearing_children_removes_all_child_views() { var layout = new TestLayout(); var view1 = new TestView(); var view2 = new TestView(); layout.Add(view1); layout.Remove(view2); layout.Clear(); layout.Children.Should().BeEmpty(); }