aau-giraf / web-api

The backend API for GIRAF — a .NET-core project written in C#.
GNU General Public License v3.0
2 stars 5 forks source link

Architecture update #326

Closed KristianS93 closed 11 months ago

KristianS93 commented 1 year ago

Description

As of now there is 14 different folders inside the Giraf Rest API, by itself this is not a problem, however as the project has grown larger this containing more files and folders, there is a necessity for a thorough update on the overall architecture and the implementation of the architecture.

The update should also include a new section of testing namely architecture tests, to ensure the expected architecture is correct.

This issue would require 4 things:

Possible Suggested Solution
Solution proposition is to take a look at fitting architecture style, this could potentially be some version of the layered architecture. The solution should also have a fitting class diagram, that can be added to the documentation and the wiki of the project, as this would be an enhancement for getting to know the project for future developers.

Regarding the architecture tests, these tests should ensure, that the communications between layers are withheld, as an example a domain layer containing entities, should not reference the project for the services, however the services project should reference the domain layer. This is possible to test using the NetArchTest nuget package Nuget GitHub

Example of how a testcase could be created. image

Definition of Done

thegrubster commented 1 year ago

It is very likely that this would also require comprehensive changes, if this part of the wiki should continue to exist at all.

KristianS93 commented 12 months ago

I have played around with the architecture testing just for fun, and even following examples of: https://www.ben-morris.com/writing-archunit-style-tests-for-net-and-c-for-self-testing-architectures/ however, I dont seem to be able to make it work, we should take a closer look if we want to do this.

EDIT: Tried one more time it works in VS but not in Rider 🗡️ Correct behavior in my toy project: image Same test and setup in rider: image