public void WhenActionIconLink_ThenGetExpectedMarkup() { var routeCollection = CreateRouteCollection(); var htmlHelper = MockHtmlHelperFactory.Create(new ViewDataDictionary(), routeCollection); var expected = "<a href=\"/ControllerName/ActionName\"><i class=\"icon-home\"></i> Navigate</a>"; var actual = ActionExtensions.ActionIconLink(htmlHelper, " Navigate", "ActionName", "ControllerName", "icon-home").ToHtmlString(); Assert.AreEqual(expected, actual); }
public void GivenHtmlAttributes_WhenActionIconLink_ThenGetExpectedMarkup() { var routeCollection = CreateRouteCollection(); var htmlHelper = MockHtmlHelperFactory.Create(new ViewDataDictionary(), routeCollection); var expected = "<a class=\"anchor\" href=\"/ControllerName/ActionName\" id=\"linkToSomethingImportant\"><i class=\"icon-home\"></i> Navigate</a>"; var htmlAttributes = new { id = "linkToSomethingImportant", @class = "anchor" }; var actual = ActionExtensions.ActionIconLink(htmlHelper, " Navigate", "ActionName", "ControllerName", "icon-home", null, htmlAttributes).ToHtmlString(); Assert.AreEqual(expected, actual); }