public void ShouldIgnoreActionParametersThatAreNull() { var attribute = new SubControllerActionToViewDataAttribute(); var controller = new TestingController(); ActionExecutingContext context = GetFilterContext(controller); context.ActionParameters["c1"] = null; context.ActionParameters["c2"] = new SubController(); attribute.OnActionExecuting(context); Assert.That(controller.ViewData.Count, Is.EqualTo(1)); Assert.That(controller.ViewData.Get<Action>("c2"), Is.Not.Null); }
public void ShouldPushTheActionOfEachSubcontrollerIntoViewdata() { var c1 = new SubController(); var c2 = new SubController(); var attribute = new SubControllerActionToViewDataAttribute(); var controller = new TestingController(); ActionExecutingContext context = GetFilterContext(controller); context.ActionParameters["c1"] = c1; context.ActionParameters["c2"] = c2; attribute.OnActionExecuting(context); Assert.That(controller.ViewData.Get<Action>("c1"), Is.Not.Null); Assert.That(controller.ViewData.Get<Action>("c2"), Is.Not.Null); }