Skip to content

Backend on Hexagonal Architecture. It`s a pattern that uses the mechanism of ports and adapters to achieve separation of concerns

Notifications You must be signed in to change notification settings

MaksymKhanin/Hexagonal-Architecture

Repository files navigation

.Net 5 
Tests: SpecFlow (SendPayloadStepsShould), IntegrationTests (SendPayloadTestsShould), UnitTests
Azure Service Bus, Azure CosmosDB, Azure Function, Mediator, Mapper

1) Setup cosmos db emulator with URL http://localhost:8081
2) In cosmos db emulator create database with name "ReadDb" and 2 containers inside: "ReadContainer" and "WriteContainer"; 
   and db with name: "WriteDb" with 2 containers: "ReadContainer" and "WriteContainer"
3) Setup environment variable on machine with 
   name: COSMOS_EMULATOR_CONNECTION_STRING 
   value: AccountEndpoint=https://localhost:8081/;
4) Setup Azure service bus with topic "mytopic". Add Service bus connection string into appsettings.dev.json 
5) Send request with payload:
{
  "number": "#12345678",
  "amount": 67
}

6) All tests pass! Ncrunch test may not be shomn in NCrunch explorer! But in Test explorer is shown well.
7) In ReadModel you by default is used Azure Function Listener. But also there is custom Azure Service Bus Listener. 
   So you can opt between them. I fyou want to use custom listener, you need to reference its dependencies from Startup.cs
   and call its methods respectively.

About

Backend on Hexagonal Architecture. It`s a pattern that uses the mechanism of ports and adapters to achieve separation of concerns

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published