diff --git a/Tests/PKHeX.Core.Tests/Legality/LegalityTests.cs b/Tests/PKHeX.Core.Tests/Legality/LegalityTests.cs index bfe257225..2da53b9b8 100644 --- a/Tests/PKHeX.Core.Tests/Legality/LegalityTests.cs +++ b/Tests/PKHeX.Core.Tests/Legality/LegalityTests.cs @@ -25,10 +25,7 @@ namespace PKHeX.Tests.Legality [Fact] public void TestFilesPassOrFailLegalityChecks() { - var folder = Directory.GetCurrentDirectory(); - while (!folder.EndsWith(nameof(Tests))) - folder = Directory.GetParent(folder).FullName; - + var folder = TestUtil.GetRepoPath(); folder = Path.Combine(folder, "Legality"); ParseSettings.AllowGBCartEra = true; VerifyAll(folder, "Legal", true); @@ -41,6 +38,7 @@ namespace PKHeX.Tests.Legality var path = Path.Combine(folder, name); Directory.Exists(path).Should().BeTrue($"the specified test directory at '{path}' should exist"); var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories); + var ctr = 0; foreach (var file in files) { var fi = new FileInfo(file); @@ -57,7 +55,10 @@ namespace PKHeX.Tests.Legality ParseSettings.AllowGen1Tradeback = fi.DirectoryName.Contains("1 Tradeback"); var legality = new LegalityAnalysis(pkm); legality.Valid.Should().Be(isValid, $"because the file '{fi.Directory.Name}\\{fi.Name}' should be {(isValid ? "Valid" : "Invalid")}"); + ctr++; } + + ctr.Should().BeGreaterThan(0); } } } diff --git a/Tests/PKHeX.Core.Tests/PKM/PKMTests.cs b/Tests/PKHeX.Core.Tests/PKM/PKMTests.cs index 63aff0490..d03ec077a 100644 --- a/Tests/PKHeX.Core.Tests/PKM/PKMTests.cs +++ b/Tests/PKHeX.Core.Tests/PKM/PKMTests.cs @@ -4,7 +4,7 @@ using FluentAssertions; using PKHeX.Core; using Xunit; -namespace PKHeX.Tests +namespace PKHeX.Tests.PKM { public static class PKMTests { diff --git a/Tests/PKHeX.Core.Tests/Saves/SMTests.cs b/Tests/PKHeX.Core.Tests/Saves/SMTests.cs index 73f6106be..62a77f039 100644 --- a/Tests/PKHeX.Core.Tests/Saves/SMTests.cs +++ b/Tests/PKHeX.Core.Tests/Saves/SMTests.cs @@ -5,31 +5,23 @@ using Xunit; namespace PKHeX.Tests.Saves { - public class SMTests + public static class SMTests { - private SAV7 GetSave() + private static SAV7 GetSave() { - var folder = GetRepoPath(); + var folder = TestUtil.GetRepoPath(); var path = Path.Combine(folder, "TestData", "SM Project 802.main"); return new SAV7(File.ReadAllBytes(path)); } - private string GetRepoPath() - { - var folder = Directory.GetCurrentDirectory(); - while (!folder.EndsWith(nameof(Tests))) - folder = Directory.GetParent(folder).FullName; - return folder; - } - [Fact] - public void ChecksumsValid() + public static void ChecksumsValid() { GetSave().ChecksumsValid.Should().BeTrue(); } [Fact] - public void ChecksumsUpdate() + public static void ChecksumsUpdate() { var save = GetSave(); var originalChecksumInfo = save.ChecksumInfo; diff --git a/Tests/PKHeX.Core.Tests/Util/TestUtil.cs b/Tests/PKHeX.Core.Tests/Util/TestUtil.cs new file mode 100644 index 000000000..f19068526 --- /dev/null +++ b/Tests/PKHeX.Core.Tests/Util/TestUtil.cs @@ -0,0 +1,15 @@ +using System.IO; + +namespace PKHeX.Tests +{ + internal static class TestUtil + { + public static string GetRepoPath() + { + var folder = Directory.GetCurrentDirectory(); + while (!folder.EndsWith(nameof(Tests))) + folder = Directory.GetParent(folder).FullName; + return folder; + } + } +}