Git Product home page Git Product logo

diegofox2 / jobofferbackend Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 7.0 156 KB

This project is a real-world example of DDD in a backend application It applies the concept of Entity, Value Object, Root, Aggregate, Services, Repositories and Ubiquitous Language.

License: MIT License

C# 100.00%
ddd ddd-architecture value-object root aggregates uml csharp coverlet report-generator code-coverage mongodb

jobofferbackend's Introduction

Coverage Status

Job Offer Backend

This project is a real-world example of DDD in a backend application

It applies the concept of Entity, Value Object, Root, Aggregate, Services, Repositories and Ubiquitous Language

There are some classic unit tests based on Services but also there are some tests over domain entities as well

See Class Diagram

Also, this project doesn't use interfaces like many projects do because in practice they are not really needed to do Unit Testing neither Inversion of Control. To go deeper on this topic, read Fake Abstractions and Header Interface

Data layer

This project uses MongoDB as a database engine through MongoDriver for C#

Nowadays, new projects do not need relational databases to store data. Instead, NoSQL databases like Mongo let you reduce a lot of code because ORM's like both Entity Framework and Dapper are no longer necessary on this paradigm. In addition, NoSQL databases are really much faster than relational databases, and most of their important features like Constraints, Triggers, Indexes, Security, Mirror Replication and Load Balance now are available for main NoSQL databases, like MongoDB.

How to run it

Download MongoDB and install it with default credentials because the project use it as it is. Otherwise, you will need to update the credentials into the project.

You must to run the console application "InitialDataCreator" so that you have a basic data set preloaded in your mongo database.

Before you set as startup proyect "JobOfferBackend.WebAPI" and run it, you have to be sure you have installed .Net Core SDK 2.2

This WebAPI project is running Swagger in order to see and test the endpoints. You only have to open the browser and go to localhost:[your port]/swagger.

Code Coverage

In order to create code coverage reports, this project also uses Coverlet and Report Generator, which can be included in some build pipelines like Azure Devops

Create a .bat file with the following script in order to execute all the tests and see the code coverage in Chrome

Remember to replace the things required in this script. This script runs on Windows

:: THIS INSTALL COVERLET AS GLOBAL

dotnet tool install --global coverlet.console

:: THIS INSTALL REPORT GENERATOR AS GLOBAL

dotnet tool install -g dotnet-reportgenerator-globaltool

:: THIS INSTALL COVERALLS.NET

dotnet tool install -g coveralls.net --version 1.0.0

:: REPLACE USING THE FOLDER OF THE SOLUTION

CD C:\Fuentes\JobOffersBackendDotNet\jobofferbackend

:: DELETE PREVIOUS CODE COVERAGE FILES AND REPORT

RMDIR C:\SourceCode\JobOffersTestResult /S /Q

:: REPLACE D: WITH THE DISK FOR SAVING THE COVERAGE REPORT

dotnet test JobOfferBackendDotNet.sln /p:CollectCoverage=true /p:CoverletOutput=D:\TestResults\Coverage\ /p:MergeWith="D:\TestResults\Coverage\coverage.json" /p:CoverletOutputFormat=\"cobertura,json\" -m:1

:: REPLACE D: WITH THE DISK FOR READING THE COVERAGE REPORT

reportgenerator "-reports:D:\TestResults\Coverage\coverage.cobertura.xml" "-targetdir:D:\TestResults\Coverage\CodeCoverageReport" -reporttypes:HtmlInline

:: DEPLACE THE SOURCE OF CHROME.EXE AND THE PATH OF THE REPORT GENERATED

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "D:\TestResults\Coverage\CodeCoverageReport\index.htm"

PAUSE

jobofferbackend's People

Contributors

diegofox2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.