Drop the Scene entity/grouping in favor of chapters carrying prose directly and beats belonging to many characters. Add markdown editor + character multi-select components to the web client. Remove all XML doc and inline comments across the touched C#/TS/CSS files in favor of self-documenting names, and record that convention in CLAUDE.md. Add .mcp.json (local MCP server config, no secrets) and ignore .idea/.
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using Novelly.Api.Chapters;
|
|
using Novelly.Api.Common;
|
|
using Novelly.Api.Common.Validation;
|
|
using Novelly.Api.Projects;
|
|
|
|
namespace Novelly.Api.Tests;
|
|
|
|
[TestFixture]
|
|
public class ExceptionHandlingTests : ServiceTestFixture
|
|
{
|
|
[Test]
|
|
public void Guard_rejects_an_empty_guid_passed_as_a_required_id() =>
|
|
Assert.That(() => Projects.GetAsync(Guid.Empty), Throws.TypeOf<ArgumentException>());
|
|
|
|
[Test]
|
|
public void Guard_rejects_a_null_request_object() =>
|
|
Assert.That(
|
|
() => Projects.CreateAsync(null!),
|
|
Throws.TypeOf<ArgumentNullException>());
|
|
|
|
[Test]
|
|
public async Task Deleting_a_missing_project_returns_false_rather_than_throwing() =>
|
|
Assert.That(await Projects.DeleteAsync(Guid.NewGuid()), Is.False);
|
|
|
|
[Test]
|
|
public void A_blank_title_fails_the_create_project_validator()
|
|
{
|
|
var result = new CreateProjectRequestValidator().Validate(new CreateProjectRequest(""));
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(result.IsInvalid, Is.True);
|
|
Assert.That(result.Errors.Select(e => e.PropertyName), Has.Member("Title"));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void Calling_a_service_directly_with_an_invalid_request_throws_rather_than_silently_accepting_it() =>
|
|
Assert.That(
|
|
() => Projects.CreateAsync(new CreateProjectRequest("")),
|
|
Throws.TypeOf<ArgumentException>());
|
|
|
|
[Test]
|
|
public async Task Creating_a_chapter_under_a_missing_project_returns_null_rather_than_throwing() =>
|
|
Assert.That(await Chapters.CreateAsync(Guid.NewGuid(), new CreateChapterRequest("Landfall")), Is.Null);
|
|
}
|