A WPF desktop application that lets you browse a library of shared spells and create and edit your own custom spells with a full undo/redo history.
The solution is split into four projects:
SpellEditor.Domain - pure data models and repository interfaces. No dependencies on any other layer. Contains Spell, Damage, Dice, and all enums.
SpellEditor.Application - business logic, services, and commands. Depends only on Domain. Contains SpellService, UndoService, LogService, SpellValidationService, and all IUndoableCommand implementations.
SpellEditor.Infrastructure - LiteDB persistence. Implements ISpellRepository and IUnitOfWork. Seeds the database on first run with a set of canonical D&D spells.
SpellEditor.UI - WPF presentation layer. Depends on Application and Infrastructure. Uses CommunityToolkit.Mvvm for MVVM, with messaging between ViewModels.
SpellEditor.Tests - NUnit test project covering Domain models, Application services, validation rules, and undo/redo behaviour. Uses FluentAssertions for assertions and Moq for mocking dependencies. The UI layer is excluded due to WPF dependencies.
- Browse spells grouped by school in a hierarchy panel
- Inspect and edit spell properties in a side panel
- Add and delete project spells
- Edit damage entries including dice count, sides, bonus, and damage type
- Full undo/redo support for all mutating operations
- Live console log showing all operations with colour-coded severity
- Validation - spells with invalid data or saving throw violations are rejected before saving
- Read-only protection - shared spells cannot be modified or deleted
| Property | Constraint |
|---|---|
| Name | Required, max 100 characters |
| Level | 0-9 (0 = cantrip) |
| Damage entries | Max 3 |
| Saving throw | Required when damage is present |
| Dice count | 1-20 |
| Dice bonus | -10-40 |
- .NET 10 / C# 14
- WPF
- LiteDB (embedded document database)
- CommunityToolkit.Mvvm
- FluentValidation
- Microsoft.Extensions.Hosting (DI + hosted services)
- NUnit + FluentAssertions + Moq (tests)
- Clone the repository
- Open
SpellEditor.slnin Visual Studio 2022 or Rider - Set
SpellEditor.UIas the startup project - Run - the database is created and seeded automatically on first launch
dotnet test
Tests cover Domain models, Application services, validation rules, and undo/redo behaviour. The UI layer is excluded from tests due to WPF dependencies.
