Exemplo n.º 1
0
        public void TestName()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Panel().SetName("Name").ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"well\" name=\"Name\"></div>");
        }
Exemplo n.º 2
0
        public void TestNavMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().AddNavigation(new Navigation("menu").AddLink(new Link("testlink"))).ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"navbar\"><div class=\"navbar-header\"><ul class=\"nav\" id=\"Navigation1\"><li><a href=\"\" id=\"testlink\"></a></li></ul></div></div>");
        }
Exemplo n.º 3
0
        public void TestName()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetName("Name").ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" name=\"Name\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemplo n.º 4
0
        public void TestAction()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetBehaviour(HtmlBehaviourType.Link).SetAction("Action").ToHtmlString();

            Assert.AreEqual(comparer, "<a class=\"btn btn-normal\" href=\"Action\" value=\"#EmptyValue\">#EmptyValue</a>");
        }
Exemplo n.º 5
0
        public void TestEmptyMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"navbar\"><div class=\"navbar-header\"></div></div>");
        }
Exemplo n.º 6
0
        public void TestDefault()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).ButtonGroup().ToString();

            Assert.AreEqual(comparer, "<div class=\"btn-group\"></div>");
        }
Exemplo n.º 7
0
        public void TestPositionFixedBottomNavMenu()
        {
            HtmlHelper htmlHelper     = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer       = SushiExtension.Sushi(htmlHelper).Menu().SetPosition(MenuPosition.FixedBottom).ToHtmlString();
            var        resultExpected = "<div class=\"navbar navbar-fixed-bottom\"><div class=\"navbar-header\"></div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }
Exemplo n.º 8
0
        public void TestAddButton()
        {
            HtmlHelper htmlHelper    = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        ButtonElement = SushiExtension.Sushi(htmlHelper).Button();
            var        comparer      = SushiExtension.Sushi(htmlHelper).ButtonGroup().AddButton(ButtonElement).ToString();

            Assert.AreEqual(comparer, "<div class=\"btn-group\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemplo n.º 9
0
        public void TestDefault100RecordsModel()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople100Collection());
            var htmlHelper     = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var resultObtained = SushiExtension.Sushi(htmlHelper).Grid(x => x).Bind().ToHtmlString();
            var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20);

            Assert.AreEqual(resultExpected, resultObtained);
        }
Exemplo n.º 10
0
        public void TestAddingHtmlInsidePanel()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Panel()
                                    .AddInnerHTML("<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />")
                                    .ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"well\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemplo n.º 11
0
        public void TestDefault()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(new List <Person>());
            var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var comparer   = SushiExtension.Sushi(htmlHelper).Grid(x => x).ToHtmlString();
            var expected   = "<table id=\"Grid1\"><thead><tr></tr></thead><tbody></tbody></table>";

            Assert.AreEqual(expected, comparer);
        }
Exemplo n.º 12
0
        public void TestMultipleComponentInsidePanel()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());

            using (SushiExtension.Sushi(htmlHelper).BeginBlock(LayoutType.Fixed))
            {
                htmlHelper.ViewContext.Writer.Write(SushiExtension.Sushi(htmlHelper).Button().ToString());
            }
            var comparer = FakeHtmlHelper.ResponseText;

            Assert.AreEqual(comparer, "<div class=\"fixed\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemplo n.º 13
0
        public void TestJavascriptIsLoaded()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection());
            var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var execution  = SushiExtension.Sushi(htmlHelper).Grid(x => x)
                             .Bind()
                             .ToHtmlString();
            var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString();
            var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultJS);

            Assert.AreEqual(resultExpected, resultObtained.ToString());
        }
Exemplo n.º 14
0
        public void TestSizes()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.normal).ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />");
            var comparer1 = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.small).ToHtmlString();

            Assert.AreEqual(comparer1, "<input class=\"btn btn-small\" type=\"submit\" value=\"#EmptyValue\" />");
            var comparer2 = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.large).ToHtmlString();

            Assert.AreEqual(comparer2, "<input class=\"btn btn-large\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemplo n.º 15
0
        public void TestTypes()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Primary).ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-primary\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Danger).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-danger\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Default).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Info).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-info\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Success).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-success\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemplo n.º 16
0
        public void TestSetGridRemoteBinding()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection());
            var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var execution  = SushiExtension.Sushi(htmlHelper).Grid(x => x)
                             .Bind()
                             .Binding(binding => binding.Setup("/StringAction"))
                             .ToHtmlString();
            var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGridRemoteBinding);

            Assert.AreEqual(expectedtable, execution);
            var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString();
            var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestGridSettedRemoteBinding);

            Assert.AreEqual(resultExpected, resultObtained);
        }
Exemplo n.º 17
0
        public void TestSetGridFilteringOff()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection());
            var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var execution  = SushiExtension.Sushi(htmlHelper).Grid(x => x)
                             .Bind()
                             .Search(search => search.SearchActive(false))
                             .ToHtmlString();
            var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20);

            Assert.AreEqual(expectedtable, execution);
            var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString();
            var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestGridFilteringOff);

            Assert.AreEqual(resultExpected, resultObtained);
        }
Exemplo n.º 18
0
        public void TestSetGridDisplayPaginationOptionsTrue()
        {
            FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection());
            var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection();
            var execution  = SushiExtension.Sushi(htmlHelper).Grid(x => x)
                             .Bind()
                             .Pagination(pagination => pagination.DisplayPaginationOptions(true))
                             .ToHtmlString();
            var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20);

            Assert.AreEqual(expectedtable, execution);
            var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString();
            var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestSettedGridPagingControls);

            Assert.AreEqual(resultExpected, resultObtained);
        }
Exemplo n.º 19
0
        public void TestThreeElementsNavMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().AddNavigation(
                new Navigation("menu")
                .AddLink(new Link("testlink"))
                .AddLink(new Link("testlink2"))
                .AddLink(new Link("testlink3"))
                ).ToHtmlString();

            var resultExpected = "<div class=\"navbar\">" +
                                 "<div class=\"navbar-header\">" +
                                 "<ul class=\"nav\" id=\"Navigation1\">" +
                                 "<li><a href=\"\" id=\"testlink\"></a></li>" +
                                 "<li><a href=\"\" id=\"testlink2\"></a></li>" +
                                 "<li><a href=\"\" id=\"testlink3\"></a></li>" +
                                 "</ul>" +
                                 "</div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }
Exemplo n.º 20
0
        public void TestAddDropDownMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu()
                                    .AddNavigationDropDown(
                new NavigationDropDown()
                .SetCaption("File")
                .AddLink(new Link().SetCaption("New").SetAction("#"))).ToHtmlString();

            var resultExpected = "<div class=\"navbar\">" +
                                 "<div class=\"navbar-header\">" +
                                 "<ul class=\"nav\">" +
                                 "<li class=\"dropdown\">" +
                                 "<a class=\"dropdown-toggle\" data-toggle=\"dropdown\">File<b class=\"caret\"></b></a>" +
                                 "<ul class=\"dropdown-menu\">" +
                                 "<li><a href=\"#\">New</a></li>" +
                                 "</ul>" +
                                 "</li>" +
                                 "</ul>" +
                                 "</div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }