private void TestNoRouteValue(IT4MVCActionResult actionResult, string name) { Assert.IsFalse(actionResult.RouteValueDictionary.ContainsKey(name)); }
private void TestRouteValue(IT4MVCActionResult actionResult, string name, object value) { Assert.AreEqual(value, actionResult.RouteValueDictionary[name]); }
// HELPER METHODS private void TestAreaControllerActionNames(IT4MVCActionResult actionResult, string area, string controller, string action) { if (UseLowerCaseNames) { area = area.ToLowerInvariant(); controller = controller.ToLowerInvariant(); action = action.ToLowerInvariant(); } TestRouteValue(actionResult, "area", area); TestRouteValue(actionResult, "controller", controller); TestRouteValue(actionResult, "action", action); }
private void TestRouteValue(IT4MVCActionResult actionResult, string name, object value) { Assert.IsTrue(actionResult.RouteValueDictionary.ContainsKey(name)); Assert.AreEqual(value, actionResult.RouteValueDictionary[name]); }
/// <summary> /// Generates an anchor tag (link) with an image inside such that the image when clicked follows the specified MVC route. /// </summary> /// <param name="helper">The class being extended with this method.</param> /// <param name="result">An IT4MVCActionResult from a T4 MVC action method used to help build urls.</param> /// <param name="imageFileName">The file name of the image including full relative path. Recommend coming from T4MVC Links property.</param> /// <param name="anchorHtmlAttributes">A dynamic object with name and value pairs for the anchor tag. Example: new {data-custom1="abc", @class="large"}</param> /// <param name="imageHtmlAttributes">A dynamic object with name and value pairs for the image tag. Example: new {data-custom1="abc", @class="large"}</param> /// <returns></returns> public static MvcHtmlString ActionImageTag(this HtmlHelper helper, ActionResult result, string imageFileName, object anchorHtmlAttributes, object imageHtmlAttributes) { IT4MVCActionResult t4 = result.GetT4MVCResult(); return(ActionImageTag(helper, t4.Action, t4.Controller, imageFileName, t4.RouteValueDictionary, anchorHtmlAttributes, imageHtmlAttributes)); }
protected RedirectToRouteResult RedirectToAction(ActionResult result) { IT4MVCActionResult callInfo = result.GetT4MVCResult(); return(this.RedirectToRoute(callInfo.RouteValueDictionary)); }