If you are developing an application using code contracts, you may know that this concept was introduced in Eiffela programming language.
I was very confused by trying this concept in my C # application using System.Diagnostics.Contracts.
The main question for me is the following:
Are unit tests necessary if you have code contracts?
One of the main differences that the unit testing infrastructure usually does not provide is the ability to call private methods (except for the library MS fakesfrom it shims). This is due to the support of composition and the idea that private methods are covered by public method calls.
With regard to the code of contracts, I can announce Contract.Requires, Contract.Ensuresfor private practices.
So why do I need unit testing when I have code contracts whose behavior is very similar.
thank
user4959035
source
share