예제 #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>");
        }
예제 #2
0
파일: MenuTest.cs 프로젝트: xareas/Sushi
        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>");
        }
예제 #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\" />");
        }
예제 #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>");
        }
예제 #5
0
파일: MenuTest.cs 프로젝트: xareas/Sushi
        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>");
        }
예제 #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>");
        }
예제 #7
0
파일: MenuTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #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>");
        }
예제 #9
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #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>");
        }
예제 #11
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #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>");
        }
예제 #13
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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());
        }
예제 #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\" />");
        }
예제 #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\" />");
        }
예제 #16
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #17
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #18
0
파일: GridTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #19
0
파일: MenuTest.cs 프로젝트: xareas/Sushi
        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);
        }
예제 #20
0
파일: MenuTest.cs 프로젝트: xareas/Sushi
        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);
        }