Exemplo n.º 1
0
        public void WithExpressionReturnsCorrectly()
        {
            var viewModel = new EmailViewModel( "*****@*****.**" );

            HtmlHelper<EmailViewModel> htmlHelper = HtmlHelperGenerator.CreateHtmlHelper( viewModel );

            var result = htmlHelper.EmailFor( x => x.Email );

            string expectedResult = string.Format( "<input id=\"Email\" name=\"Email\" type=\"email\" value=\"{0}\" />", viewModel.Email );
            Assert.AreEqual( expectedResult, result.ToHtmlString() );
        }
Exemplo n.º 2
0
        public void WithExpressionAndAttributeExpressionReturnsCorrectly()
        {
            var viewModel = new EmailViewModel( "*****@*****.**" );
            string attributeName = "attributeName";
            string attributeValue = "attributeValue";

            HtmlHelper<EmailViewModel> htmlHelper = HtmlHelperGenerator.CreateHtmlHelper( viewModel );

            var result = htmlHelper.EmailFor( x => x.Email, x => x.Attribute( attributeName, attributeValue ) );

            string expectedResult = string.Format( "<input {0}=\"{1}\" id=\"Email\" name=\"Email\" type=\"email\" value=\"{2}\" />", attributeName, attributeValue, viewModel.Email );
            Assert.AreEqual( expectedResult, result.ToHtmlString() );
        }