|
From: RBScheer on 13 Jul 2008 15:04 Hi. I have written unit tests for my helper classes that return simple values as strings or integers. Now I need to test the methods that deal with DataSets and DataTables. Is there any special issues when running these kind of tests? I ask this because if I create a DataSet from scratch reproducing the desired structure and compare this to the real DataSet I got from running my helper class, the Assert.AreEqual method says me they are not equal! But both DataSets have the same tables, columns and number of records. Any help would be greatly appreciated ! Regards, RBScheer
From: rowe_newsgroups on 13 Jul 2008 16:40 On Jul 13, 3:04 pm, RBScheer <rbsch...(a)my-deja.com> wrote: > Hi. > > I have written unit tests for my helper classes that return simple > values as strings or integers. Now I need to test the methods that > deal with DataSets and DataTables. Is there any special issues when > running these kind of tests? I ask this because if I create a DataSet > from scratch reproducing the desired structure and compare this to the > real DataSet I got from running my helper class, the Assert.AreEqual > method says me they are not equal! But both DataSets have the same > tables, columns and number of records. > > Any help would be greatly appreciated ! > > Regards, > RBScheer That's a really good question, and not one that I really know an answer for. If it were me, I'd test as much functionality as you can, say making sure that you have rows, or a certain number of rows, and that you have the appropriate columns. You could even spot check the values of a few of the data rows if you like. The other option would be to loop through the actual dataset members and compare them with the expected dataset using Assert.IsTrue(...). That way if any of the members don't match, the Assert.IsTrue would fail. To be honest, I'm not sure if I like either method, but at least some coverage is better than no coverage. And just to be a pain, why is you are writing your tests after the code? IMO, you should be doing it the other way around :-) Thanks, Seth Rowe [MVP] http://sethrowe.blogspot.com/
|
Pages: 1 Prev: need additional help with pp Next: Where is urn:schemas-microsoft-com:asm.v1? |