c# - DisplayFormat unit testing with HtmlHelper -
mymodel _model = new mymodel() { pricedate = new datetime(2000, 1, 1)}; var helper = new system.web.mvc.htmlhelper<mymodel>(new viewcontext(), new viewpage()); var result = helper.displayfor(m => _model.pricedate); assert.that(result, is.equalto(expected));
i want test output produced calling displayfor
in format specified by...
[displayformat(dataformatstring = "{0:dd/mm/yy}")] public datetime? pricedate { get; set; }
the code compiles fails nullreferenceexception
@ displayfor
.
can me make work?
(note: trivial example of larger problem)
the steps quite long couldn't write here. wrote @ blog :d
http://thoai-nguyen.blogspot.com/2011/07/unit-test-displayformat-attribute.html
cheers
Comments
Post a Comment