.Net Core Api exercise - Light marketing domain
- Clients have exclusive advertisement campaigns
- Channels are treated as reference data since they are not expected to be added/modified constantly.
- Since the requirement was for a simple CRUD implementation, I decided to use a service/repository approach. If more business logic was required it could be added to the service classes or the approach could be changed to a more domain driven one.
- When creating/updating advertisements, only existing channels can be linked.
- Advertisements can't be deleted unless all links to channels are removed
- Channels can't be deleted unless all links to advertisements are removed
- The client domain was not included as it did not add value to the exercise
- .Net Core 2.0 and EntityFramework 2.0 were used.
- A TypeScript client (\MarketingClient\MarketingClient.ts) was generated using NSwagStudio in order to make testing the Api easier.
- Swagger was used to document the api, additional documentation features from Swagger could also be used depending on the documentation requirements.
- The json generated by Swagger can also be used to create collections in Postman in order to help with testing the Api.
- Url path segment versioning is done using the Microsoft.AspNetCore.Mvc.Versioning library. this library also supports other versioning options.
- Manual mapping was used for domain and entities because the objects used are very simple, for cases where more objects are needed then probably I would use a library like Automapper.
- The DbInitializer class was added for testing purposes.
- Unit test were added in order to verify expected behaviour.
- Integration tests were added at the Api and Persistence layers.
- The following tools and libraries were used for testing:
- xUnit
- FluentAssertions
- Moq
- AutoFixture
- EntityFramework InMemory database