public void WithExpressionReturnsCorrectly() { var viewModel = new NumberViewModel( 1 ); HtmlHelper<NumberViewModel> htmlHelper = HtmlHelperGenerator.CreateHtmlHelper( viewModel ); var result = htmlHelper.NumberFor( x => x.Number ); string expectedResult = string.Format( "<input id=\"Number\" name=\"Number\" type=\"number\" value=\"{0}\" />", viewModel.Number ); Assert.AreEqual( expectedResult, result.ToHtmlString() ); }
public void WithExpressionAndAttributeExpressionReturnsCorrectly() { var viewModel = new NumberViewModel( 1 ); string attributeName = "attributeName"; string attributeValue = "attributeValue"; HtmlHelper<NumberViewModel> htmlHelper = HtmlHelperGenerator.CreateHtmlHelper( viewModel ); var result = htmlHelper.NumberFor( x => x.Number, x => x.Attribute( attributeName, attributeValue ) ); string expectedResult = string.Format( "<input {0}=\"{1}\" id=\"Number\" name=\"Number\" type=\"number\" value=\"{2}\" />", attributeName, attributeValue, viewModel.Number ); Assert.AreEqual( expectedResult, result.ToHtmlString() ); }