Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void Adding_null_child_throws_exception()
        {
            var layout = new TestLayout();

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

            addNullChild.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }