public void GetModelStateValueReturnsNullIfModelStateKeyNotPresent() { // Arrange ViewDataDictionary vdd = new ViewDataDictionary(); HtmlHelper helper = new HtmlHelper(new ViewContext(), new SimpleViewDataContainer(vdd)); // Act object retVal = helper.GetModelStateValue("key_not_present", typeof(object)); // Assert Assert.IsNull(retVal); }
public void GetModelStateValueReturnsNullIfModelStateHasNoValue() { // Arrange ViewDataDictionary vdd = new ViewDataDictionary(); vdd.ModelState.AddModelError("foo", "some error text"); // didn't call SetModelValue() HtmlHelper helper = new HtmlHelper(new ViewContext(), new SimpleViewDataContainer(vdd)); // Act object retVal = helper.GetModelStateValue("foo", typeof(object)); // Assert Assert.IsNull(retVal); }