Exemplo n.º 1
0
        public void GetCurrentFormTitle_GetsTitle()
        {
            String expected = MvcTemplate.Resources.Form.Titles.AdministrationAccounts;
            String actual   = ResourceProvider.GetCurrentFormTitle();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void GetCurrentFormTitle_GetsTitleWithoutArea()
        {
            routeValues["controller"] = "Profile";
            routeValues["area"]       = null;

            String expected = MvcTemplate.Resources.Form.Titles.Profile;
            String actual   = ResourceProvider.GetCurrentFormTitle();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void FormWidgetBox_FormsWidgetBox()
        {
            StringBuilder expected = new StringBuilder();

            new WidgetBox(new StringWriter(expected), "fa fa-th-list", ResourceProvider.GetCurrentFormTitle(), String.Empty).Dispose();

            StringBuilder actual = new StringBuilder();

            html.ViewContext.Writer = new StringWriter(actual);
            html.FormWidgetBox().Dispose();

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Exemplo n.º 4
0
        public void FormWidgetBox_FormsWidgetBoxWithButtons()
        {
            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-list", ResourceProvider.GetCurrentFormTitle(), buttons).Dispose();

            html.ViewContext.Writer = new StringWriter(actual);
            html.FormWidgetBox(LinkAction.Create, LinkAction.Details, LinkAction.Edit, LinkAction.Delete).Dispose();

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Exemplo n.º 5
0
        public void FormWidgetBox_FormsWidgetBoxWithAuthorizedButtons()
        {
            Authorization
            .Provider
            .IsAuthorizedFor(
                Arg.Any <String>(),
                Arg.Any <String>(),
                Arg.Any <String>(),
                Arg.Is <String>(value => new[] { "Create", "Edit" }.Contains(value)))
            .Returns(true);

            StringBuilder expected = new StringBuilder();
            StringBuilder actual   = new StringBuilder();

            String buttons = FormTitleButtons(LinkAction.Create, LinkAction.Edit);

            new WidgetBox(new StringWriter(expected), "fa fa-th-list", ResourceProvider.GetCurrentFormTitle(), buttons).Dispose();

            html.ViewContext.Writer = new StringWriter(actual);
            html.FormWidgetBox(LinkAction.Create, LinkAction.Details, LinkAction.Edit).Dispose();

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Exemplo n.º 6
0
        public void GetCurrentFormTitle_OnFormNotFoundReturnsNull()
        {
            routeValues["controller"] = "Controller";

            Assert.IsNull(ResourceProvider.GetCurrentFormTitle());
        }
Exemplo n.º 7
0
 public static WidgetBox FormWidgetBox(this HtmlHelper html, params LinkAction[] actions)
 {
     return(html.WidgetBox("fa fa-th-list", ResourceProvider.GetCurrentFormTitle(), actions));
 }