Add tests
Test what is engine-free: Service and Domain. UI/Level are not unit-tested.
Reference: NoteServiceTests.cs.
Stack is NUnit + Moq (already in tests/Game.Tests/Game.Tests.csproj).
Rules:
Location mirrors source:
src/Game/<Module>/Service/<X>.cs→tests/Game.Tests/<Module>/Service/<X>Tests.cs. Test namespace:Game.Tests.<Module>.<Layer>.Mock
Commoninterfaces with Moq —IJsonStateFileHandlerService,IRandomGeneratorService,IIdService, etc. Use real in-memory repositories (SingleRepository<T>/CollectionRepository<...>) when convenient.Structure:
[TestFixture],[SetUp]to build the system under test, one[Test]per behavior. Assert withAssert.That(actual, Is.EqualTo(...)).Cover: happy path, edge/empty cases, and that the service calls its dependencies correctly (
mock.Verify(...)). When a method returns a file/IO result, assert the returnedFileError/bool and the resulting in-memory state.No redundant tests — don't test framework code, trivial getters, or Godot behavior. Keep tests current with the code.
After writing, run the
verifyskill.
Example shape:
[SetUp] public void SetUp() { _dep = new Mock<IDep>(); _sut = new XService(_repo, _dep.Object); }
[Test]
public void DoesThing()
{
_dep.Setup(d => d.Call(It.IsAny<...>())).Returns(...);
var result = _sut.DoThing();
Assert.That(result, Is.EqualTo(...));
_dep.Verify(d => d.Call(It.IsAny<...>()), Times.Once);
}