Merge branch 'phase/51-warmth-lesson'
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -190,6 +190,54 @@ public class LessonTeacherPresentTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cold_LogsOnce_AndGainsLess()
|
||||
{
|
||||
var (school, homeroom, pupilId, teacherId) = StaffedMath();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
SetPlace(school, pupilId, homeroom);
|
||||
SetPlace(school, teacherId, homeroom);
|
||||
var classmate = school.Roster!.Classes.First(row => row.PupilIds.Contains(pupilId))
|
||||
.PupilIds.First(id => id != pupilId);
|
||||
SetPlace(school, classmate, homeroom);
|
||||
SetNeed(school, pupilId, "Warmth", 0.1f);
|
||||
SetNeed(school, classmate, "Warmth", 1f);
|
||||
var coldBefore = SkillOf(school, pupilId, "Mathematics");
|
||||
var warmBefore = SkillOf(school, classmate, "Mathematics");
|
||||
|
||||
LessonLearningSystem.Apply(school, 5);
|
||||
LessonLearningSystem.Apply(school, 5);
|
||||
|
||||
var rows = school.DayLog
|
||||
.Where(row => row.PersonId == pupilId && row.Type == PersonLogTypes.LessonCold)
|
||||
.ToArray();
|
||||
Assert.Single(rows);
|
||||
Assert.Equal("Mathematics", rows[0].ThingDef);
|
||||
Assert.Equal("замёрз на уроке: Математика", rows[0].Caption(school.Catalog!, "ru"));
|
||||
Assert.True(SkillOf(school, classmate, "Mathematics") - warmBefore
|
||||
> SkillOf(school, pupilId, "Mathematics") - coldBefore);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cold_DoesNotLog_WhenTeacherIsAbsent()
|
||||
{
|
||||
var (school, homeroom, pupilId, teacherId) = StaffedMath();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
SetPlace(school, pupilId, homeroom);
|
||||
SetPlace(school, teacherId, "restroom-1");
|
||||
SetNeed(school, pupilId, "Warmth", 0.1f);
|
||||
|
||||
LessonLearningSystem.Apply(school, 45);
|
||||
|
||||
Assert.DoesNotContain(school.DayLog, row => row.Type == PersonLogTypes.LessonCold);
|
||||
}
|
||||
}
|
||||
|
||||
private static (School School, string Homeroom, string PupilId, string TeacherId) StaffedMath(
|
||||
string? teacherId = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user