예제 #1
0
        Control IDisplayable.AddTo(ContentItem item, string detailName, Control container)
        {
            if (!(item is IArticle))
            {
                throw new ArgumentException("The supplied item " + item.Path + "#" + item.ID + " of type '" + item.GetContentType().FullName + "' doesn't implement IArticle.", "item");
            }

            WikiParser   parser   = Engine.Resolve <WikiParser>();
            WikiRenderer renderer = Engine.Resolve <WikiRenderer>();

            PlaceHolder ph = new PlaceHolder();

            container.Controls.Add(ph);

            renderer.AddTo(parser.Parse((string)item[detailName]), ph, item);

            return(ph);
        }
예제 #2
0
 public void SetUp()
 {
     parser = new WikiParser();
 }
예제 #3
0
        public override void SetUp()
        {
            base.SetUp();

            var urlParser = new FakeUrlParser();
            wiki = new N2.Addons.Wiki.Items.Wiki();
            wiki.Name = "wiki";
            ((IDependentEntity<IUrlParser>)wiki).Set(urlParser);
            article = new N2.Addons.Wiki.Items.WikiArticle();
            article.Name = "existing-article";
            article.SavedBy = "admin";
            ((IDependentEntity<IUrlParser>)article).Set(urlParser);
            article.AddTo(wiki);

            parser = new WikiParser();

            var pluginFinder = mocks.Stub<IPluginFinder>();
            Expect.Call(pluginFinder.GetPlugins<ITemplateRenderer>()).Return(new ITemplateRenderer[] { new FakeTemplateRenderer() });
            mocks.ReplayAll();

            renderer = new WikiRenderer(pluginFinder, new ThreadContext());
        }