PlotDirector/PlotLine.Tests/WriterAuthoringTests.cs

17 lines
1.7 KiB
C#

using PlotLine.Models;
internal static class WriterAuthoringTests
{
public static void Run(){void Check(bool ok,string name){if(!ok)throw new Exception(name);Console.WriteLine("PASS Writer authoring "+name);}
Check(AuthoringSchema.Validate("Note",new Dictionary<string,string?>{{"SceneNoteTypeID","1"},{"NoteText",""}})!=null,"blank notes are rejected");
Check(AuthoringSchema.Validate("Checklist",new Dictionary<string,string?>{{"ItemText",new string('x',301)}})!=null,"reminder length is bounded");
Check(AuthoringSchema.Validate("Workflow",new Dictionary<string,string?>{{"Priority","11"}})!=null,"priority range is enforced");
Check(AuthoringSchema.Validate("Workflow",new Dictionary<string,string?>{{"DraftedDate","2026-02-30"}})!=null,"invalid calendar dates are rejected");
Check(AuthoringSchema.Validate("Workflow",new Dictionary<string,string?>{{"EstimatedWordCount","-2"}})!=null,"negative counts are rejected");
Check(AuthoringSchema.Validate("Scene",new Dictionary<string,string?>{{"ScenePurposeNotes","<script>untrusted</script> — Unicode"}})==null,"ordinary author text remains text, not generated markup");
Check(AuthoringSchema.Validate("Goals",new Dictionary<string,string?>())==null,"chapter intentions remain optional");
Check(new AuthoringSection{Kind="Goals",Data="[]"}.Value("GoalSummary")=="","missing optional records render as empty values");
Check(AuthoringSchema.Validate("Scene",new Dictionary<string,string?>{{"ScenePurposeNotes",new string('界',25000)}})==null,"canonical unbounded supporting text is not arbitrarily truncated");
Check(AuthoringSchema.Validate("Unknown",new Dictionary<string,string?>())!=null,"unknown editor types are rejected");
}
}