Example #1
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);
        }
Example #2
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);
        }
Example #3
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());
        }
Example #4
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);
        }
Example #5
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);
        }
Example #6
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);
        }