public void Setup()
        {
            _container = new MocksAndStubsContainer();

            _applicationSettings = _container.ApplicationSettings;
            _context = _container.UserContext;
            _repository = _container.Repository;
            _pluginFactory = _container.PluginFactory;
            _settingsService = _container.SettingsService;
            _userService = _container.UserService;

            _specialPagesController = new SpecialPagesController(_applicationSettings, _userService, _context, _settingsService, _pluginFactory);
        }
Beispiel #2
0
        public override ActionResult GetResult(SpecialPagesController controller)
        {
            RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
            List<PageViewModel> pages = PageService.AllPages().ToList();

            if (pages.Count == 0)
            {
                routeValueDictionary.Add("controller", "Home");
                routeValueDictionary.Add("action", "Index");
            }
            else
            {
                int randomIndex = _random.Next(0, pages.Count -1);
                PageViewModel randomPage = pages[randomIndex];

                routeValueDictionary.Add("controller", "Wiki");
                routeValueDictionary.Add("action", "Index");
                routeValueDictionary.Add("id", randomPage.Id);
            }

            return new RedirectToRouteResult(routeValueDictionary);
        }
 /// <summary>
 /// Returns an <see cref="System.Web.Mvc.ActionResult"/> for the special page. This can include a <see cref="ViewResult"/> that 
 /// points to a view in the /Plugin/PluginId folder.
 /// </summary>
 /// <param name="controller">The <see cref="SpecialPagesController"/> that the action belongs to.</param>
 /// <returns></returns>
 public abstract ActionResult GetResult(SpecialPagesController controller);
Beispiel #4
0
		public void Setup()
		{
			_container = new MocksAndStubsContainer();
			_controller = null; // not used
		}
Beispiel #5
0
		public override ActionResult GetResult(SpecialPagesController controller)
		{
			return new ContentResult() { Content = "Some content" };
		}