Home > database >  Unit testing with Clean Architecture
Unit testing with Clean Architecture

Time:10-13

I have Core project which contains e.g. interaface ISomeValidator and in Application project I have implementation of this interface. If I want to test this interface, should I create test named like Core.UnitTests or Application.UnitTests? I don't know because Core contains interface of this class and Application his implementation. And I will use interface, not directly implementation.

CodePudding user response:

The main purpose of unit testing is "quality assurance". We want to ensure that the code is behaving as expected. But if there are interfaces only - which do not have any logic - what would unit tests do then?

Besides that, if the "core" project only contains interfaces I would suggest to reconsider the way how the code is organized. Usually the "core" project would contain the main business logic, the domain model, the rules which are valid/important for all use cases. If this logic is not in the "core" project, what is the purpose of "core" then?

  • Related