Skip to content

Commit 2928119

Browse files
committedJul 7, 2024·
updated tests to skip skipped lessons
1 parent 2806789 commit 2928119

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed
 

Diff for: ‎LearnJsonEverything.Tests/ProvidedSolutionTests.cs

+8-22
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,22 @@ public void Setup()
1818
CompilationHelpers.TestOnly_SetReferences(ReferenceLoader.Load());
1919
}
2020

21-
private static LessonPlan LoadLessonPlan(string filename)
21+
private static IEnumerable<TestCaseData> GetLessons(string filename)
2222
{
2323
var json = File.ReadAllText(filename);
24-
return JsonSerializer.Deserialize<LessonPlan>(json, SerializerOptions)!;
25-
}
24+
var lessonPlan = JsonSerializer.Deserialize<LessonPlan>(json, SerializerOptions)!;
2625

27-
public static IEnumerable<TestCaseData> SchemaLessons
28-
{
29-
get
30-
{
31-
var lessonPlan = LoadLessonPlan("schema.json");
32-
return lessonPlan.Select(x =>
26+
return lessonPlan.Where(x => !x.Skip)
27+
.Select(x =>
3328
{
3429
x.UserCode = x.Solution;
3530
return new TestCaseData(x) { TestName = x.Title };
3631
});
37-
}
3832
}
3933

34+
35+
public static IEnumerable<TestCaseData> SchemaLessons => GetLessons("schema.json");
36+
4037
[TestCaseSource(nameof(SchemaLessons))]
4138
public void Schema(LessonData lesson)
4239
{
@@ -53,18 +50,7 @@ public void Schema(LessonData lesson)
5350
}
5451
}
5552

56-
public static IEnumerable<TestCaseData> PathLessons
57-
{
58-
get
59-
{
60-
var lessonPlan = LoadLessonPlan("path.json");
61-
return lessonPlan.Select(x =>
62-
{
63-
x.UserCode = x.Solution;
64-
return new TestCaseData(x) { TestName = x.Title };
65-
});
66-
}
67-
}
53+
public static IEnumerable<TestCaseData> PathLessons => GetLessons("path.json");
6854

6955
[TestCaseSource(nameof(PathLessons))]
7056
public void Path(LessonData lesson)

0 commit comments

Comments
 (0)
Please sign in to comment.