public void PasswordWithNameAndValue() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("foo", "fooValue"); // Assert Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""password"" value=""fooValue"" />", html.ToHtmlString()); }
public void PasswordWithNullNameThrows() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act & Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.Password(null), "name"); ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.Password(String.Empty), "name"); }
public void PasswordWithImplicitValueAndAttributesObject() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("foo", null, _attributesObject); // Assert Assert.AreEqual(@"<input baz=""BazValue"" id=""foo"" name=""foo"" type=""password"" />", html.ToHtmlString()); }
public void PasswordWithImplicitValueAndAttributesDictionaryReturnsEmptyValueIfNotFound() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("keyNotFound", null, _attributesDictionary); // Assert Assert.AreEqual(@"<input baz=""BazValue"" id=""keyNotFound"" name=""keyNotFound"" type=""password"" />", html.ToHtmlString()); }
public void PasswordWithExplicitValueNull() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("foo", value: (string)null); // Assert Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""password"" />", html.ToHtmlString()); }
public void PasswordWithExplicitValueAndAttributesObject() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("foo", "DefaultFoo", new Dictionary<string, object> { { "baz", "BazValue" } }); // Assert Assert.AreEqual(@"<input baz=""BazValue"" id=""foo"" name=""foo"" type=""password"" value=""DefaultFoo"" />", html.ToHtmlString()); }
public void PasswordExplicitParametersOverrideDictionary() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act var html = helper.Password("foo", "Some Value", new { value = "Another Value", name = "bar" }); // Assert Assert.AreEqual(@"<input id=""foo"" name=""foo"" type=""password"" value=""Some Value"" />", html.ToHtmlString()); }