public void TestMissingAttribute() { var model = new TagModel(new Hashtable()); model.Page[Html.PAGE_MODEL_HTMLHELPER_INSTANCE] = GetHtmlHelper(); model.Model["name"] = "name"; try { ITag tag = CreateFactory().Parse("<html:radioButton name=\"${Model.name}\"/>"); tag.Evaluate(model); Assert.Fail("Expected exception"); } catch (HtmlHelperTagException HHTe) { Assert.That(HHTe.MessageWithOutContext, Is.EqualTo( HtmlHelperTagException.RequiredArgumentMissing( "value", CandateMethod( Html.New <RadioButtonTag>(new List <IParameterValue> { new ParameterValue { Name = "name" } }) )).Message) ); } }
public void AssembleParametersShouldCorrectlyBuildParameterArrayMissingRequiredArgument() { var tag = new TestHtmlTag { Parameters = new List <IParameterValue> { new TestParameterValue { Name = "isChecked", TestValue = true } } }; try { tag.AssembleParameters(tag.Method, GetHelper(), null); Assert.Fail("Expected exception"); } catch (HtmlHelperTagException HHTe) { Assert.That(HHTe.Message, Is.EqualTo(HtmlHelperTagException.RequiredArgumentMissing("name", tag.Method).Message)); } }