Files
h-school/tests/HSchool.Content.Tests/TopicDefTests.cs
T
Leonid PershinandCursor f7d5e0c042 Add lesson whispers, teacher catch chance, and after-bell teacher talk.
Whispering cuts lesson skill gain from BehaviorDef; a teacher in the room may interrupt into a discipline circle, and pedagogy scales the pupil's opinion of the teacher.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 10:35:31 +03:00

37 lines
1.4 KiB
C#

using HSchool.Content;
using HSchool.Content.Tests;
namespace HSchool.Content.Tests;
public class TopicDefTests
{
private readonly CatalogLoader _loader = new();
[Fact]
public void VanillaCore_LoadsTalkTopics()
{
var root = Path.Combine(AppContext.BaseDirectory, "vanilla");
var catalog = _loader.Load([CatalogLoader.CorePackId], PackDocuments.FromDirectory(CatalogLoader.CorePackId, root));
Assert.True(catalog.Topics.Count >= 8);
Assert.True(catalog.Topics.ContainsKey("TopicStudy"));
Assert.Contains("study", catalog.Topics["TopicStudy"].Tags);
Assert.True(catalog.Topics["TopicGames"].WhisperOnLesson);
Assert.False(catalog.Topics["TopicRude"].WhisperOnLesson);
Assert.True(catalog.Topics.ContainsKey("TopicPraise"));
Assert.True(catalog.Topics.ContainsKey("TopicDiscipline"));
}
[Fact]
public void CatalogWithoutTopics_ThrowsOnLoad()
{
var root = Path.Combine(AppContext.BaseDirectory, "vanilla");
var documents = PackDocuments.FromDirectory(CatalogLoader.CorePackId, root)
.Where(document => !document.RelativePath.Contains("defs/topics/", StringComparison.OrdinalIgnoreCase))
.ToList();
var ex = Assert.Throws<ContentLoadException>(() => _loader.Load([CatalogLoader.CorePackId], documents));
Assert.Contains("TopicDef", ex.Message, StringComparison.Ordinal);
}
}