Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }