I am using .net unit testing in my project. I can unit test, get methods by using Assert.AreEqual. But how can i test Insert/update/delete methods. Please help
Thanks in advance.
Yes it is very bad practice - you're letting your tools make design decisions for you. I think the main problem here is that you're trying to treat each individual method as a unit. This is generally the cause of all unit test woes.
For insert, the basic test pattern could be:
For update:
For delete:
Note than in order to compare reference entities, you can do it manually for each entity type or use a recursive entity comparison method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With