MikrocopTest
This repository contains a .NET 10 solution with:
MikrocopApi: ASP.NET Core Web APIMikrocopDb: Entity Framework Core data access layer (SQLite)MikrocopTests: NUnit test project
Technologies Used
- .NET SDK 10 (
net10.0) - ASP.NET Core Web API
- Entity Framework Core 10
- SQLite (
Microsoft.EntityFrameworkCore.Sqlite) - JWT authentication (
Microsoft.AspNetCore.Authentication.JwtBearer) - Swagger / OpenAPI (
Swashbuckle.AspNetCore) - Serilog (console + rolling file logs)
- NUnit + Moq + Microsoft.NET.Test.Sdk
Prerequisites
- .NET 10 SDK installed
Check your installed version:
dotnet --version
How to Run the Program
From the repository root:
dotnet restore
dotnet run --project MikrocopApi
Notes:
- In
Development, EF Core migrations are applied automatically on startup. - Swagger UI is available at
http://localhost:5018/swaggerby default. - Development DB connection string is in
MikrocopApi/appsettings.Development.json(mikrocop.dev.db).
How to Use the API (JWT Flow)
To use protected endpoints, follow this order:
- Register a user with
POST /api/auth/register - Log in with
POST /api/auth/login - Copy the returned JWT token and send it as:
Authorization: Bearer <token>
Notes:
api/auth/registerandapi/auth/loginare anonymous endpoints.api/users/*endpoints require authentication ([Authorize]).- In Swagger, use the Authorize button and paste the token as
Bearer <token>.
How to Run the Tests
Run all tests in the solution:
dotnet test MikrocopTest.sln
Or run only the test project:
dotnet test MikrocopTests/MikrocopTests.csproj
Description
Languages
C#
100%