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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -