示例#1
0
        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);
        }
示例#2
0
        public void Adding_null_child_throws_exception()
        {
            var layout = new TestLayout();

            Action addNullChild = () => layout.Add(null);

            addNullChild.Should().Throw <ArgumentNullException>();
        }
示例#3
0
        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);
        }
示例#4
0
        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();
        }
示例#5
0
        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();
        }