Following is the exact scenario in my application:
- There are several C# methods in the codebase which are using Entity
framework to talk with SQL database.
- Unit tests are written against all methods, and covers all possible permutation and combinations based on method signature, input requirements, and return values.
- Unit tests are working fine, and are failing when they should (i.e., cases like some validation is changed or expected return value is changed, but unit tests are not reflected for the same).
- There are cases, where a developer performs a change in SQL schema, and updates the entity in the C# code. In this case, unit tests are passing which is absolutely fine because its just underlying logic is changed, but not the input, validations, or return value.
- However, I want some unit tests to be failed when the database schema and entity are changed, but unit tests are not changed. That means, I want developers to fix the unit tests when they change database schema and entity.
Can anyone please suggest how to achieve the same?
Any help on this would be much appreciated.
Thanks
Copyright Notice:Content Author:「Nirman」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56543925/fail-the-unit-tests-when-the-database-schema-and-entity-are-changed-but-unit-t