public void GetCurrentTableTitle_GetsTitle() { routeValues["action"] = "Index"; String expected = MvcTemplate.Resources.Table.Titles.AdministrationAccountsIndex; String actual = ResourceProvider.GetCurrentTableTitle(); Assert.AreEqual(expected, actual); }
public void TableWidgetBox_FormsTableWidgetBox() { StringBuilder expected = new StringBuilder(); StringBuilder actual = new StringBuilder(); new WidgetBox(new StringWriter(expected), "fa fa-th", ResourceProvider.GetCurrentTableTitle(), String.Empty).Dispose(); html.ViewContext.Writer = new StringWriter(actual); html.TableWidgetBox().Dispose(); Assert.AreEqual(expected.ToString(), actual.ToString()); }
public void TableWidgetBox_FormsTableWidgetBoxWithButtons() { StringBuilder expected = new StringBuilder(); StringBuilder actual = new StringBuilder(); Authorization.Provider = null; String buttons = FormTitleButtons(LinkAction.Create, LinkAction.Details, LinkAction.Edit, LinkAction.Delete); new WidgetBox(new StringWriter(expected), "fa fa-th", ResourceProvider.GetCurrentTableTitle(), buttons).Dispose(); html.ViewContext.Writer = new StringWriter(actual); html.TableWidgetBox(LinkAction.Create, LinkAction.Details, LinkAction.Edit, LinkAction.Delete).Dispose(); Assert.AreEqual(expected.ToString(), actual.ToString()); }
public void TableWidgetBox_FormsTableWidgetBoxWithAuthorizedButtons() { Authorization .Provider .IsAuthorizedFor( Arg.Any <String>(), Arg.Any <String>(), Arg.Any <String>(), Arg.Is <String>(value => new[] { "Details", "Delete" }.Contains(value))) .Returns(true); StringBuilder expected = new StringBuilder(); StringBuilder actual = new StringBuilder(); String buttons = FormTitleButtons(LinkAction.Details, LinkAction.Delete); new WidgetBox(new StringWriter(expected), "fa fa-th", ResourceProvider.GetCurrentTableTitle(), buttons).Dispose(); html.ViewContext.Writer = new StringWriter(actual); html.TableWidgetBox(LinkAction.Create, LinkAction.Details, LinkAction.Edit, LinkAction.Delete).Dispose(); Assert.AreEqual(expected.ToString(), actual.ToString()); }
public void GetCurrentTableTitle_OnTableNotFoundReturnsNull() { Assert.IsNull(ResourceProvider.GetCurrentTableTitle()); }
public static WidgetBox TableWidgetBox(this HtmlHelper html, params LinkAction[] actions) { return(html.WidgetBox("fa fa-th", ResourceProvider.GetCurrentTableTitle(), actions)); }