Files
James Wampler 4313c8f206 Rename Project concept to Novel across the stack
Renames the domain concept from Project to Novel throughout the backend
(entities, DTOs, services, endpoints, ProjectAccessService/Permission,
ProjectId foreign keys), MCP server (tool names and routes), and the
React/Vite frontend (types, hooks, routes, components). Adds a new EF
Core migration (RenameProjectToNovel) using RenameTable/RenameColumn to
preserve existing data instead of dropping/recreating tables. Updates
CLAUDE.md's structure section to reference Novels/ instead of Projects/.
2026-08-17 23:03:09 -07:00

45 lines
1.4 KiB
C#

using Novelly.Api.Novels;
namespace Novelly.Api.Tests;
[TestFixture]
public class GenreServiceTests : ServiceTestFixture
{
[Test]
public async Task The_genre_list_arrives_seeded_and_alphabetical()
{
var listed = await Genres.ListAsync();
Assert.Multiple(() =>
{
Assert.That(listed, Is.Not.Empty);
Assert.That(listed.Select(g => g.Name), Has.Member("Fantasy").And.Member("Literary Fiction"));
Assert.That(listed.Select(g => g.Name), Is.Ordered);
Assert.That(listed.Select(g => g.Id), Is.Unique);
});
}
[Test]
public async Task A_novel_can_be_filed_under_a_genre_off_the_list()
{
var fantasy = (await Genres.ListAsync()).First(g => g.Name == "Fantasy");
var novel = await Novels.CreateAsync(new CreateNovelRequest("The Salt Road", Genre: fantasy.Name));
Assert.That(novel.Genre, Is.EqualTo("Fantasy"));
}
[Test]
public async Task A_novel_can_still_carry_a_genre_that_is_not_on_the_list()
{
var novel = await Novels.CreateAsync(
new CreateNovelRequest("The Salt Road", Genre: "Nautical Gothic"));
Assert.Multiple(async () =>
{
Assert.That(novel.Genre, Is.EqualTo("Nautical Gothic"));
Assert.That((await Genres.ListAsync()).Select(g => g.Name), Has.No.Member("Nautical Gothic"));
});
}
}