remy porter remy escaped the enterprise world and now works as a consultant. editor-in-chief for tdwtf. 




unit tests are a wonderful tool for proving that your code works. ideally, when you<u+2019>re using other code, like say, the .net framework, you don<u+2019>t write tests that test the framework itself. after all, didn<u+2019>t microsoft already do that? 




david t <u+2019>s co-worker laughs at your na<u+00ef>vet<u+00e9> . why would you trust microsoft ? you need to make sure the framework works as advertised. which is why their unit tests are mostly made up of code like this: [test] public void it_converts_datatype_text_into_concretetype() { const string datatypetext = "system.datetime"; var datatype = type.gettype(datatypetext); assert.istrue(datatype == typeof(datetime)); } [test] public void it_converts_string_into_given_datatype() { const string data = "10-10-2014"; const string datatypetext = "system.datetime"; var datatype = type.gettype(datatypetext); object newdata = convert.changetype(data, datatype); assert.that(newdata, is.typeof<datetime>()); } 




now, if the .net framework<u+2019>s ability to load and recognize types ever breaks, david<u+2019>s team will be the first to know. [advertisement] application release automation <u+2013> build complex release pipelines all managed from one central dashboard, accessibility for the whole team. download and learn more today!
codesod: a type of test
remy porter