Kays
❔ Docker file for Multi-layered project
The following Dockerfile is working fine for me :
FROM mcr.microsoft.com/dotnet/aspnet:7.0.2-jammy AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["Project.API/Project.API.csproj", "Project.API/"]
COPY ["Project.Library/Project.Library.csproj", "Project.Library/"]
RUN dotnet restore "Project.API/Project.API.csproj"
COPY . .
WORKDIR "/src/Project.API"
RUN dotnet build "Project.API.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "ProjectAPI.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Project.API.dll"]
61 replies
❔ C# - How to set up hexagonal architecture in a c# project using TDD
Here the git folder of what I've been doing so far. You will find the subject in a README.md file. : https://github.com/harili/project-training/tree/main/BankAccountProject/BankAccount.Core.Tests
21 replies
❔ C# - How to set up hexagonal architecture in a c# project using TDD
Oh my bad I copied the wrong text. Here the good one :
Depositing a positive amount should increase the account balance.
Attempting to deposit a zero or negative amount should raise an exception.
Withdrawal of an amount less than the current balance should decrease the account balance.
Attempting to withdraw an amount greater than or equal to the current balance should remove an exception.
21 replies
❔ C# - How to set up hexagonal architecture in a c# project using TDD
So I wrote some use case :
Create an Account object with an initial balance.
Call the Withdraw method of the AccountService with a specified amount.
Assert that the method returns the correct balance after the withdrawal.
Assert that the balance of the Account object has been updated correctly.
21 replies
❔ C# - How to set up hexagonal architecture in a c# project using TDD
Here the structure of my solution .sln :
- API project
- Library classes project :
- Business
- Account.cs
- Transaction.cs
- Data
- Account.cs
- Transaction.cs
-Services
- Repositories
- IAccount.cs (interface)
- AccountService.cs
- Test project (xUnit)
- AccountTest.cs
21 replies