static DescriptionBag()
        {
            Add("TitleOnly", x => x.Title = "Only a title");

            Add("TitleAndShortDescription", x =>
            {
                x.Title = "The title text";
                x.ShortDescription = "The short description";
            });

            Add("TitleAndShortAndLongDescription", x =>
            {
                x.Title = "The title text";
                x.ShortDescription = "The short description";
                x.LongDescription = "A really long description that might be truncated later";
            });

            Add("WithProperties", x =>
            {
                x.Title = "The title text";
                x.ShortDescription = "The short description";

                x.Properties["Color"] = "Red";
                x.Properties["Direction"] = "South";
                x.Properties["Order"] = "1";
            });



            Add("WithChildren", x =>
            {
                x.Title = "Description with children";
                x.ShortDescription = "More stuff here";

                x.Children["One"] = _bag["TitleOnly"];
                x.Children["Two"] = _bag["TitleAndShortAndLongDescription"];
                x.Children["Three"] = _bag["WithProperties"];
            });

            Add("BulletList", x =>
            {
                x.Title = "The title text";
                x.ShortDescription = "The short description";

                var list = new BulletList
                {
                    Name = "Handlers"
                };

                list.Children.Add(_bag["TitleOnly"]);
                list.Children.Add(_bag["TitleAndShortAndLongDescription"]);
                list.Children.Add(_bag["WithProperties"]);
                list.Children.Add(_bag["WithChildren"]);

                x.BulletLists.Add(list);
            });
        }
Exemple #2
0
        public BulletList AddList(string name, IEnumerable objects)
        {
            var list = new BulletList {
                Name = name
            };

            BulletLists.Add(list);

            objects.Each(x =>
            {
                var desc = Description.For(x);
                list.Children.Add(desc);
            });

            return(list);
        }
        public BulletList AddList(string name, IEnumerable objects)
        {
            var list = new BulletList{
                Name = name
            };
            
            BulletLists.Add(list);

            objects.Each(x =>
            {
                var desc = Description.For(x);
                list.Children.Add(desc);
            });

            return list;
        }
Exemple #4
0
        void IDescriptionVisitor.StartList(BulletList list)
        {
            _level++;
            _report.AddText(spacer() + _icon + (list.Label ?? list.Name));
            _level++;

            if (list.IsOrderDependent)
            {
                _prefixes.Push(new NumberedPrefixSource(numberOfSpacesOnLeft));
            }
            else
            {
                addUnorderedPrefix();
            }

            _report.StartColumns(new Column(ColumnJustification.right, 0, 0), new Column(ColumnJustification.left, 0, 5), new Column(ColumnJustification.left, 0, 0));
        }
        void IDescriptionVisitor.StartList(BulletList list)
        {
            _level++;
            _report.AddText(spacer() + " ** " + (list.Label ?? list.Name));
            _level++;

            if (list.IsOrderDependent)
            {
                _prefixes.Push(new NumberedPrefixSource(numberOfSpacesOnLeft));
            }
            else
            {
                _prefixes.Push(new UnorderedPrefixSource(numberOfSpacesOnLeft));
            }

            _report.StartColumns(2);
        }
        public void accept_visitory_with_multiple_bullet_lists()
        {
            var repo = new MockRepository();
            var visitor = repo.StrictMock<IDescriptionVisitor>();

            var description = new Description();

            var list = new BulletList();
            list.Children.Add(new Description());
            list.Children.Add(new Description());
            list.Children.Add(new Description());

            description.BulletLists.Add(list);
            description.BulletLists.Add(new BulletList());

            using (repo.Record())
            {
                visitor.Start(description);

                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();

                visitor.StartList(description.BulletLists.Last());
                visitor.EndList();

                visitor.End();
            }

            using (repo.Playback())
            {
                description.AcceptVisitor(visitor);
            }
        }
        public void SetUp()
        {
            theStep = new ValidationStep(typeof(string), typeof(ConfiguredValidationSource), new IValidationRule[] { new Rule1(), new Rule2()  });

            theDescription = Description.For(theStep);
            theRuleList = theDescription.BulletLists.Single();
        }
        void IDescriptionVisitor.StartList(BulletList list)
        {
            _level++;
            _report.AddText(spacer() + _icon + (list.Label ?? list.Name));
            _level++;

            if (list.IsOrderDependent)
            {
                _prefixes.Push(new NumberedPrefixSource(numberOfSpacesOnLeft));
            }
            else
            {
                addUnorderedPrefix();
            }

            _report.StartColumns(new Column(ColumnJustification.right, 0, 0), new Column(ColumnJustification.left, 0, 5), new Column(ColumnJustification.left, 0, 0));
        }
Exemple #9
0
 private void writeBulletList(BulletList list)
 {
     Add("div").AddClass("desc-list-name").Text(list.Label ?? list.Name);
     list.Children.Each(writeBulletItem);
 }
Exemple #10
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);
            }
        }
        public void SetUp()
        {
            theLibrary = new ConverterLibrary();
            var basicConverterFamily = new BasicConverterFamily(theLibrary);

            theDescription = Description.For(basicConverterFamily);

            // Just lifts the Family list right off of ConverterLibrary
            theFamilyList = theDescription.BulletLists.Single();
        }
Exemple #12
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);
            }
        }
        public void SetUp()
        {
            thePlan = new ValidationPlan(typeof(string), new ValidationStep[0]);

            theDescription = Description.For(thePlan);
            theStepList = theDescription.BulletLists.Single();
        }
        public void SetUp()
        {
            theRegistry = new BindingRegistry();
            var binder = new ConversionPropertyBinder(theRegistry);
            theDescription = Description.For(binder);

            theConversionList = theDescription.BulletLists.Single();
        }
        public void SetUp()
        {
            theLibrary = new ConverterLibrary();

            theDescription = Description.For(theLibrary);
            theFamilyList = theDescription.BulletLists.Single();
        }
        void IDescriptionVisitor.StartList(BulletList list)
        {
            _level++;
            _report.AddText(spacer() + " ** " + (list.Label ?? list.Name));
            _level++;

            if (list.IsOrderDependent)
            {
                _prefixes.Push(new NumberedPrefixSource(numberOfSpacesOnLeft));
            }
            else
            {
                _prefixes.Push(new UnorderedPrefixSource(numberOfSpacesOnLeft));
            }

            _report.StartColumns(2);
        }
        public void SetUp()
        {
            theRegistry = new BindingRegistry();
            theDescription = Description.For(theRegistry).BulletLists.Single().Children.Single();

            thePropertyBinderList = theDescription.BulletLists.Single();
        }