This repository contains a minimal raffle application built with .NET. It is organised as a Visual Studio solution with a few projects:
- RaffleApi – the ASP.NET web API that exposes raffle endpoints.
- RaffleDraw – the library with the raffle domain and business logic.
- TheTests – xUnit tests for the RaffleDraw domain.
Use the .NET SDK (version 9 or later) to restore and build all projects:
# restore packages and compile
dotnet build Lalaland.slnTo launch the web API during development run:
# start RaffleApi
dotnet run --project RaffleApiThe API listens on the default ASP.NET ports and provides Swagger UI for exploration.
The following endpoints are available:
POST /raffles- create a raffle.GET /raffles/{id}- retrieve a raffle by id. The response now includes aselectedTicketsarray listing winning tickets.POST /raffles/{id}/tickets- purchase a ticket.POST /raffles/{id}/winner- select a winning ticket and return the ticket number.
Unit tests are found in the TheTests project and can be executed with:
dotnet test TheTests/TheTests.csproj