Beispiel #1
0
        public override void SetUp()
        {
            base.SetUp();

            var urlParser = new FakeUrlParser();

            wiki      = new N2.Addons.Wiki.Items.Wiki();
            wiki.Name = "wiki";
            ((IInjectable <IUrlParser>)wiki).Set(urlParser);
            article         = new N2.Addons.Wiki.Items.WikiArticle();
            article.Name    = "existing-article";
            article.SavedBy = "admin";
            ((IInjectable <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());
        }
Beispiel #2
0
        protected override void OnInit(EventArgs e)
        {
            if (IsNew)
            {
                h1.Text = CurrentArguments;
            }
            else
            {
                h1.Text      = CurrentPage.Title;
                txtText.Text = CurrentPage.Text;
            }
            txtText.EnableFreeTextArea = CurrentPage.WikiRoot.EnableFreeText;
            phSubmit.Visible           = cvAuthorized.IsValid = IsAuthorized;
            if (!string.IsNullOrEmpty(Text))
            {
                WikiParser   parser   = Engine.Resolve <WikiParser>();
                WikiRenderer renderer = Engine.Resolve <WikiRenderer>();
                renderer.AddTo(parser.Parse(Text), pnlMessage, CurrentPage);
            }

            Register.JQuery(Page);

            base.OnInit(e);
        }