public void TextBoxWithImplicitValueAndAttributesObject() {
            // Arrange
            var modelState = new ModelStateDictionary();
            modelState.SetModelValue("foo", "fooModelValue");
            HtmlHelper helper = new HtmlHelper(modelState);

            // Act
            var html = helper.TextBox("foo", null, _attributesObject);

            // Assert
            Assert.AreEqual(@"<input baz=""BazValue"" id=""foo"" name=""foo"" type=""text"" value=""fooModelValue"" />", html.ToHtmlString());
        }
        public void TextBoxWithNameAndValue() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo", "fooValue");

            // Assert
            Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""text"" value=""fooValue"" />", html.ToHtmlString());
        }
        public void TextBoxWithExplicitValueAndAttributesObject() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo", "DefaultFoo", _attributesObject);

            // Assert
            Assert.AreEqual(@"<input baz=""BazValue"" id=""foo"" name=""foo"" type=""text"" value=""DefaultFoo"" />", html.ToHtmlString());
        }
        public void TextBoxWithExplicitValueNull() {
            // Arrange
            var modelState = new ModelStateDictionary();
            modelState.SetModelValue("foo", "fooModelValue");
            HtmlHelper helper = new HtmlHelper(modelState);

            // Act
            var html = helper.TextBox("foo", (string)null /* value */, (object)null);

            // Assert
            Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""text"" value=""fooModelValue"" />", html.ToHtmlString());
        }
        public void TextBoxWithExplicitValue() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo", "DefaultFoo", (object)null);

            // Assert
            Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""text"" value=""DefaultFoo"" />", html.ToHtmlString());
        }
        public void TextBoxWithEmptyNameThrows() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act & Assert
            ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.TextBox(null), "name");
            ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.TextBox(String.Empty), "name");

        }
        public void TextBoxWithDotReplacementForId() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo.bar.baz", null);

            // Assert
            Assert.AreEqual(@"<input id=""foo_bar_baz"" name=""foo.bar.baz"" type=""text"" value="""" />", html.ToHtmlString());
        }
        public void TextBoxExplicitParametersOverrideDictionaryValues() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo", "DefaultFoo", new { value = "Some other value" });

            // Assert
            Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""text"" value=""DefaultFoo"" />", html.ToHtmlString());
        }
        public void TextBoxDictionaryOverridesImplicitValues() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextBox("foo", "DefaultFoo", new { type = "fooType" });

            // Assert
            Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""fooType"" value=""DefaultFoo"" />", html.ToHtmlString());
        }