Exemple #1
0
        public void HiddenLocation_When_Model_Is_Null()
        {
            var          htmlHelper   = MvcMockHelpers.CreateHtmlHelper(new ViewDataDictionary());
            const string expectedHtml = "<input id=\"Latitude\" name=\"Latitude\" type=\"hidden\" value=\"\" /><input id=\"Longitude\" name=\"Longitude\" type=\"hidden\" value=\"\" />";

            var actualHtml = htmlHelper.HiddenLocation();

            Assert.AreEqual(expectedHtml, actualHtml.ToHtmlString());
        }
Exemple #2
0
        public void ImageUploadFor()
        {
            var model    = new CreateServiceModel();
            var viewData = new ViewDataDictionary <CreateServiceModel>(model);

            var          htmlHelper   = MvcMockHelpers.CreateHtmlHelper(viewData);
            const string expectedHtml = "<input accept=\"image/gif,image/jpeg,image/png\" id=\"Image\" name=\"Image\" type=\"file\" />";

            var actualHtml = htmlHelper.ImageUploadFor(m => m.Image);

            Assert.AreEqual(expectedHtml, actualHtml.ToHtmlString());
        }
Exemple #3
0
        public void HiddenLocation_When_Model_Is_Passed()
        {
            var model = new CreateServiceModel {
                Latitude = 13.37, Longitude = 60.61
            };
            var          htmlHelper   = MvcMockHelpers.CreateHtmlHelper(new ViewDataDictionary(model));
            const string expectedHtml = "<input id=\"Latitude\" name=\"Latitude\" type=\"hidden\" value=\"13.37\" /><input id=\"Longitude\" name=\"Longitude\" type=\"hidden\" value=\"60.61\" />";

            var actualHtml = htmlHelper.HiddenLocation();

            Assert.AreEqual(expectedHtml, actualHtml.ToHtmlString());
        }
Exemple #4
0
        public void HiddenLocation_When_Model_Is_Passed_With_Model_State()
        {
            var model = new CreateServiceModel {
                Latitude = 13.37, Longitude = 60.61
            };
            var viewData = new ViewDataDictionary(model);

            viewData.ModelState.Add("Latitude", new ModelState {
                Value = new ValueProviderResult(13.37, "13.37", null)
            });
            viewData.ModelState.Add("Longitude", new ModelState {
                Value = new ValueProviderResult(60.61, "60.61", null)
            });

            var          htmlHelper   = MvcMockHelpers.CreateHtmlHelper(viewData);
            const string expectedHtml = "<input id=\"Latitude\" name=\"Latitude\" type=\"hidden\" value=\"13.37\" /><input id=\"Longitude\" name=\"Longitude\" type=\"hidden\" value=\"60.61\" />";

            var actualHtml = htmlHelper.HiddenLocation();

            Assert.AreEqual(expectedHtml, actualHtml.ToHtmlString());
        }