This project is a simple a person store. There are two folders:
- PersonStore is a BE project (.NET Core C#)
- person-store is a FE project (react, hooks)
Backend is using SQL Lite, which is included as a part of a project. There is no need to configure anything in order to run the application, no external data source is needed.
One can just open VS and click run (IIS Express
) to run the backend, and run npm run start
to run frontend. Backend has CORS enabled to allowed calls from FE.
On a backed following operations are exposed.
On a fronted user is able to add and search for people.
Simple loading message and error handling is supported.
Currently FE is really simple. I feel like a form is already a good candidate to split into smaller files.
-
I like to think as an API project (PersonStore) as an entry point, it should be as simple as possible.
-
I like to extract everything I can to a Service project (like DI config, automapper config, etc...).
-
Folders DTO and Data are good candidates to be extracted to a separate projects in a future. To save time and also because the scope of this work is so small I kept Data management responsibility (Repository/EF) and Service layer in this same project. Again if this solution would grow, I will extract it to a separate project.
-
I don't use transactions for a single insert operation. If I were to insert into multiple tables/data stores at this same time, I would wrap it in a transaction.
-
I don't see point in writing unit tests/integration/system tests in C# for entry point project (PersonStore).
-
I like unit testing guidelines from Roy Osherove book (The Art of Unit Testing). This is what I try to follow. What is written in a book is that you should not try to test frameworks like EF, or code that runs a third party libraries, just focus on a business logic code. That is why I am not interested in putting a test harness on top of Persons table creation script, EF or automapper.
-
I would normally add extra level of integration testing/system testing on top of my API, but I feel that I already spent too much time on this exercise.
-
StoreController exposes a method to create a Person table, in case if someone would like to drop provided SQL Lite database and create it from scratch.