-2

Related Question

My Question:

In the key of ASP.NET-MVC - Do Database Default Values Break The Spirit of Unit Testing?

Community
  • 1
  • 1
Jim G.
  • 15,141
  • 22
  • 103
  • 166
  • The "spirit of unit testing" is very vague. What does that even mean? The definition of unit testing is code that tests code. Is that the spirit? If your code tests code but that code hits the database its still code that tests code... – John Farrell Oct 11 '10 at 03:16

2 Answers2

1

I don't see what a database has to do with unit testing. If you are talking about integration testing that's whole other story but a unit test should never hit a database, so to answer your question: no, database default values do not break the spirit of unit testing.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
0

I put default values in the database if it's going to be an integration point between applications. Whenever I do use a default value, I always set that property in the constructor of my entity to the same value. So in this sense, I don't see why it would invalidate unit testing.

Ryan
  • 4,303
  • 3
  • 24
  • 24