コード例 #1
0
        public void bullet_list_accept_visitor_with_children()
        {
            var repo    = new MockRepository();
            var visitor = repo.StrictMock <IDescriptionVisitor>();

            var list = new BulletList();

            list.Children.Add(new Description());
            list.Children.Add(new Description());
            list.Children.Add(new Description());

            using (repo.Record())
            {
                visitor.StartList(list);

                visitor.Start(list.Children[0]);
                visitor.End();

                visitor.Start(list.Children[1]);
                visitor.End();

                visitor.Start(list.Children[2]);
                visitor.End();

                visitor.EndList();
            }

            using (repo.Playback())
            {
                list.AcceptVisitor(visitor);
            }
        }
コード例 #2
0
        public void bullet_list_accept_visitor_with_no_innards()
        {
            var repo    = new MockRepository();
            var visitor = repo.StrictMock <IDescriptionVisitor>();

            var list = new BulletList();

            using (repo.Record())
            {
                visitor.StartList(list);
                visitor.EndList();
            }

            using (repo.Playback())
            {
                list.AcceptVisitor(visitor);
            }
        }