From c16c988fda473c8bee34bbbab16b6ae5e13f5efb Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Sat, 9 Aug 2025 15:26:06 -0400 Subject: [PATCH] Merge pull request #539 from CJ-SPT/test-mod Intoduce test mod and restructure test suites into their own solution folder --- .../Benchmarks}/Benchmarks.csproj | 12 ++++--- .../Benchmarks}/ClonerBenchmarks.cs | 0 .../Benchmarks}/MathUtilInterpBenchmarks.cs | 0 .../Benchmarks}/Mock/MockLogger.cs | 0 {Benchmarks => Testing/Benchmarks}/Program.cs | 0 Testing/TestMod/Resources/.gitkeep | 0 Testing/TestMod/TestMod.cs | 32 +++++++++++++++++ Testing/TestMod/TestMod.csproj | 25 +++++++++++++ {UnitTests => Testing/UnitTests}/DI.cs | 0 .../UnitTests}/Mock/MockLogger.cs | 0 .../UnitTests}/Mock/MockRandomUtil.cs | 0 .../UnitTests}/TestAssets/quests.json | 0 .../Extensions/ContainerExtensionsTests.cs | 0 .../UnitTests}/Tests/Extensions/ItemTests.cs | 0 .../Generators/BotWeaponGeneratorTests.cs | 0 .../Tests/Helpers/BotGeneratorHelperTests.cs | 0 .../Tests/Helpers/InRaidHelperTests.cs | 0 .../Tests/Helpers/InventoryHelperTests.cs | 0 .../UnitTests}/Tests/MongoIDTests.cs | 0 .../UnitTests}/Tests/Utils/JsonUtilTests.cs | 0 .../UnitTests}/Tests/Utils/MathUtilTests.cs | 0 .../UnitTests}/Tests/Utils/MongoIdTests.cs | 0 .../UnitTests}/Tests/Utils/RandomUtilTests.cs | 0 .../UnitTests}/UnitTests.csproj | 10 +++--- server-csharp.sln | 35 ++++++++++++------- 25 files changed, 92 insertions(+), 22 deletions(-) rename {Benchmarks => Testing/Benchmarks}/Benchmarks.csproj (51%) rename {Benchmarks => Testing/Benchmarks}/ClonerBenchmarks.cs (100%) rename {Benchmarks => Testing/Benchmarks}/MathUtilInterpBenchmarks.cs (100%) rename {Benchmarks => Testing/Benchmarks}/Mock/MockLogger.cs (100%) rename {Benchmarks => Testing/Benchmarks}/Program.cs (100%) create mode 100644 Testing/TestMod/Resources/.gitkeep create mode 100644 Testing/TestMod/TestMod.cs create mode 100644 Testing/TestMod/TestMod.csproj rename {UnitTests => Testing/UnitTests}/DI.cs (100%) rename {UnitTests => Testing/UnitTests}/Mock/MockLogger.cs (100%) rename {UnitTests => Testing/UnitTests}/Mock/MockRandomUtil.cs (100%) rename {UnitTests => Testing/UnitTests}/TestAssets/quests.json (100%) rename {UnitTests => Testing/UnitTests}/Tests/Extensions/ContainerExtensionsTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Extensions/ItemTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Generators/BotWeaponGeneratorTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Helpers/BotGeneratorHelperTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Helpers/InRaidHelperTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Helpers/InventoryHelperTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/MongoIDTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Utils/JsonUtilTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Utils/MathUtilTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Utils/MongoIdTests.cs (100%) rename {UnitTests => Testing/UnitTests}/Tests/Utils/RandomUtilTests.cs (100%) rename {UnitTests => Testing/UnitTests}/UnitTests.csproj (59%) diff --git a/Benchmarks/Benchmarks.csproj b/Testing/Benchmarks/Benchmarks.csproj similarity index 51% rename from Benchmarks/Benchmarks.csproj rename to Testing/Benchmarks/Benchmarks.csproj index b31cc8df..e475c5bb 100644 --- a/Benchmarks/Benchmarks.csproj +++ b/Testing/Benchmarks/Benchmarks.csproj @@ -1,5 +1,5 @@ - + Exe enable @@ -7,14 +7,16 @@ - - - - PreserveNewest + + + + + + diff --git a/Benchmarks/ClonerBenchmarks.cs b/Testing/Benchmarks/ClonerBenchmarks.cs similarity index 100% rename from Benchmarks/ClonerBenchmarks.cs rename to Testing/Benchmarks/ClonerBenchmarks.cs diff --git a/Benchmarks/MathUtilInterpBenchmarks.cs b/Testing/Benchmarks/MathUtilInterpBenchmarks.cs similarity index 100% rename from Benchmarks/MathUtilInterpBenchmarks.cs rename to Testing/Benchmarks/MathUtilInterpBenchmarks.cs diff --git a/Benchmarks/Mock/MockLogger.cs b/Testing/Benchmarks/Mock/MockLogger.cs similarity index 100% rename from Benchmarks/Mock/MockLogger.cs rename to Testing/Benchmarks/Mock/MockLogger.cs diff --git a/Benchmarks/Program.cs b/Testing/Benchmarks/Program.cs similarity index 100% rename from Benchmarks/Program.cs rename to Testing/Benchmarks/Program.cs diff --git a/Testing/TestMod/Resources/.gitkeep b/Testing/TestMod/Resources/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Testing/TestMod/TestMod.cs b/Testing/TestMod/TestMod.cs new file mode 100644 index 00000000..4605aa5a --- /dev/null +++ b/Testing/TestMod/TestMod.cs @@ -0,0 +1,32 @@ +using SPTarkov.DI.Annotations; +using SPTarkov.Server.Core.DI; +using SPTarkov.Server.Core.Models.Spt.Mod; +using SPTarkov.Server.Core.Models.Utils; + +namespace TestMod; + +public record TestModMetadata : AbstractModMetadata +{ + public override string ModGuid { get; init; } = "com.sp-tarkov.test-mod"; + public override string Name { get; init; } = "test-mod"; + public override string Author { get; init; } = "SPTarkov"; + public override List? Contributors { get; set; } + public override string Version { get; init; } = "1.0.0"; + public override string SptVersion { get; init; } = "4.0.0"; + public override List? LoadBefore { get; set; } + public override List? LoadAfter { get; set; } + public override List? Incompatibilities { get; set; } + public override Dictionary? ModDependencies { get; set; } + public override string? Url { get; set; } + public override bool? IsBundleMod { get; set; } + public override string? License { get; init; } = "MIT"; +} + +[Injectable(TypePriority = OnLoadOrder.PostDBModLoader + 1)] +public class TestMod(ISptLogger logger) : IOnLoad +{ + public Task OnLoad() + { + return Task.CompletedTask; + } +} diff --git a/Testing/TestMod/TestMod.csproj b/Testing/TestMod/TestMod.csproj new file mode 100644 index 00000000..cb614f39 --- /dev/null +++ b/Testing/TestMod/TestMod.csproj @@ -0,0 +1,25 @@ + + + + enable + + + + + + + + + + + + + + + + + + diff --git a/UnitTests/DI.cs b/Testing/UnitTests/DI.cs similarity index 100% rename from UnitTests/DI.cs rename to Testing/UnitTests/DI.cs diff --git a/UnitTests/Mock/MockLogger.cs b/Testing/UnitTests/Mock/MockLogger.cs similarity index 100% rename from UnitTests/Mock/MockLogger.cs rename to Testing/UnitTests/Mock/MockLogger.cs diff --git a/UnitTests/Mock/MockRandomUtil.cs b/Testing/UnitTests/Mock/MockRandomUtil.cs similarity index 100% rename from UnitTests/Mock/MockRandomUtil.cs rename to Testing/UnitTests/Mock/MockRandomUtil.cs diff --git a/UnitTests/TestAssets/quests.json b/Testing/UnitTests/TestAssets/quests.json similarity index 100% rename from UnitTests/TestAssets/quests.json rename to Testing/UnitTests/TestAssets/quests.json diff --git a/UnitTests/Tests/Extensions/ContainerExtensionsTests.cs b/Testing/UnitTests/Tests/Extensions/ContainerExtensionsTests.cs similarity index 100% rename from UnitTests/Tests/Extensions/ContainerExtensionsTests.cs rename to Testing/UnitTests/Tests/Extensions/ContainerExtensionsTests.cs diff --git a/UnitTests/Tests/Extensions/ItemTests.cs b/Testing/UnitTests/Tests/Extensions/ItemTests.cs similarity index 100% rename from UnitTests/Tests/Extensions/ItemTests.cs rename to Testing/UnitTests/Tests/Extensions/ItemTests.cs diff --git a/UnitTests/Tests/Generators/BotWeaponGeneratorTests.cs b/Testing/UnitTests/Tests/Generators/BotWeaponGeneratorTests.cs similarity index 100% rename from UnitTests/Tests/Generators/BotWeaponGeneratorTests.cs rename to Testing/UnitTests/Tests/Generators/BotWeaponGeneratorTests.cs diff --git a/UnitTests/Tests/Helpers/BotGeneratorHelperTests.cs b/Testing/UnitTests/Tests/Helpers/BotGeneratorHelperTests.cs similarity index 100% rename from UnitTests/Tests/Helpers/BotGeneratorHelperTests.cs rename to Testing/UnitTests/Tests/Helpers/BotGeneratorHelperTests.cs diff --git a/UnitTests/Tests/Helpers/InRaidHelperTests.cs b/Testing/UnitTests/Tests/Helpers/InRaidHelperTests.cs similarity index 100% rename from UnitTests/Tests/Helpers/InRaidHelperTests.cs rename to Testing/UnitTests/Tests/Helpers/InRaidHelperTests.cs diff --git a/UnitTests/Tests/Helpers/InventoryHelperTests.cs b/Testing/UnitTests/Tests/Helpers/InventoryHelperTests.cs similarity index 100% rename from UnitTests/Tests/Helpers/InventoryHelperTests.cs rename to Testing/UnitTests/Tests/Helpers/InventoryHelperTests.cs diff --git a/UnitTests/Tests/MongoIDTests.cs b/Testing/UnitTests/Tests/MongoIDTests.cs similarity index 100% rename from UnitTests/Tests/MongoIDTests.cs rename to Testing/UnitTests/Tests/MongoIDTests.cs diff --git a/UnitTests/Tests/Utils/JsonUtilTests.cs b/Testing/UnitTests/Tests/Utils/JsonUtilTests.cs similarity index 100% rename from UnitTests/Tests/Utils/JsonUtilTests.cs rename to Testing/UnitTests/Tests/Utils/JsonUtilTests.cs diff --git a/UnitTests/Tests/Utils/MathUtilTests.cs b/Testing/UnitTests/Tests/Utils/MathUtilTests.cs similarity index 100% rename from UnitTests/Tests/Utils/MathUtilTests.cs rename to Testing/UnitTests/Tests/Utils/MathUtilTests.cs diff --git a/UnitTests/Tests/Utils/MongoIdTests.cs b/Testing/UnitTests/Tests/Utils/MongoIdTests.cs similarity index 100% rename from UnitTests/Tests/Utils/MongoIdTests.cs rename to Testing/UnitTests/Tests/Utils/MongoIdTests.cs diff --git a/UnitTests/Tests/Utils/RandomUtilTests.cs b/Testing/UnitTests/Tests/Utils/RandomUtilTests.cs similarity index 100% rename from UnitTests/Tests/Utils/RandomUtilTests.cs rename to Testing/UnitTests/Tests/Utils/RandomUtilTests.cs diff --git a/UnitTests/UnitTests.csproj b/Testing/UnitTests/UnitTests.csproj similarity index 59% rename from UnitTests/UnitTests.csproj rename to Testing/UnitTests/UnitTests.csproj index 2a8de658..be31a7e7 100644 --- a/UnitTests/UnitTests.csproj +++ b/Testing/UnitTests/UnitTests.csproj @@ -1,5 +1,5 @@ - + enable @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/server-csharp.sln b/server-csharp.sln index 81d24599..9cfc18dc 100644 --- a/server-csharp.sln +++ b/server-csharp.sln @@ -10,8 +10,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Server.Core", "Lib {20A5EBD3-75D1-4E06-8240-09EEF874017A} = {20A5EBD3-75D1-4E06-8240-09EEF874017A} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{6C0681F9-4013-4579-82DA-0A9297984FD3}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{F084DDFD-89F3-44F9-89C3-5CA11F4CDEEF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{587959C2-5AFA-4B77-B327-566610F9A289}" @@ -26,8 +24,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Server.Assets", "L EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideoutCraftQuestIdGenerator", "Tools\HideoutCraftQuestIdGenerator\HideoutCraftQuestIdGenerator.csproj", "{C24B1FEB-F8AC-434E-998D-5DA4D1687295}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{6884273A-72E9-4035-B5BE-EE101C69F5F5}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Reflection", "Libraries\SPTarkov.Reflection\SPTarkov.Reflection.csproj", "{9073A593-A2F5-471E-9678-B896A7226FD4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonExtensionDataGenerator", "Tools\JsonExtensionDataGenerator\JsonExtensionDataGenerator.csproj", "{6F4670CD-6861-47A8-9A02-2B63AD73A929}" @@ -36,6 +32,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Patches", "Patches", "{9E41 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ceciler.Virtualizer", "Patches\Ceciler.Virtualizer\Ceciler.Virtualizer.csproj", "{20A5EBD3-75D1-4E06-8240-09EEF874017A}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{07B50C44-6D38-474E-87AF-68672D241EEB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Testing\Benchmarks\Benchmarks.csproj", "{3E342BAC-EE44-44E4-8E99-393F0C9F787C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "Testing\UnitTests\UnitTests.csproj", "{28B90486-1436-4CD7-88D0-122B6963AB58}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestMod", "Testing\TestMod\TestMod.csproj", "{755E473C-14F2-40BC-9377-2FAB11CA91DC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -50,10 +54,6 @@ Global {AC8643DC-8779-4B4A-BBDA-2D4CC466F765}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC8643DC-8779-4B4A-BBDA-2D4CC466F765}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC8643DC-8779-4B4A-BBDA-2D4CC466F765}.Release|Any CPU.Build.0 = Release|Any CPU - {6C0681F9-4013-4579-82DA-0A9297984FD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C0681F9-4013-4579-82DA-0A9297984FD3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C0681F9-4013-4579-82DA-0A9297984FD3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C0681F9-4013-4579-82DA-0A9297984FD3}.Release|Any CPU.Build.0 = Release|Any CPU {4B4AF50D-B2C6-47D1-B567-EA4560D8CBA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4B4AF50D-B2C6-47D1-B567-EA4560D8CBA1}.Debug|Any CPU.Build.0 = Debug|Any CPU {4B4AF50D-B2C6-47D1-B567-EA4560D8CBA1}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -74,10 +74,6 @@ Global {C24B1FEB-F8AC-434E-998D-5DA4D1687295}.Debug|Any CPU.Build.0 = Debug|Any CPU {C24B1FEB-F8AC-434E-998D-5DA4D1687295}.Release|Any CPU.ActiveCfg = Release|Any CPU {C24B1FEB-F8AC-434E-998D-5DA4D1687295}.Release|Any CPU.Build.0 = Release|Any CPU - {6884273A-72E9-4035-B5BE-EE101C69F5F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6884273A-72E9-4035-B5BE-EE101C69F5F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6884273A-72E9-4035-B5BE-EE101C69F5F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6884273A-72E9-4035-B5BE-EE101C69F5F5}.Release|Any CPU.Build.0 = Release|Any CPU {9073A593-A2F5-471E-9678-B896A7226FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9073A593-A2F5-471E-9678-B896A7226FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU {9073A593-A2F5-471E-9678-B896A7226FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -90,6 +86,18 @@ Global {20A5EBD3-75D1-4E06-8240-09EEF874017A}.Debug|Any CPU.Build.0 = Debug|Any CPU {20A5EBD3-75D1-4E06-8240-09EEF874017A}.Release|Any CPU.ActiveCfg = Release|Any CPU {20A5EBD3-75D1-4E06-8240-09EEF874017A}.Release|Any CPU.Build.0 = Release|Any CPU + {3E342BAC-EE44-44E4-8E99-393F0C9F787C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E342BAC-EE44-44E4-8E99-393F0C9F787C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E342BAC-EE44-44E4-8E99-393F0C9F787C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E342BAC-EE44-44E4-8E99-393F0C9F787C}.Release|Any CPU.Build.0 = Release|Any CPU + {28B90486-1436-4CD7-88D0-122B6963AB58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28B90486-1436-4CD7-88D0-122B6963AB58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28B90486-1436-4CD7-88D0-122B6963AB58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28B90486-1436-4CD7-88D0-122B6963AB58}.Release|Any CPU.Build.0 = Release|Any CPU + {755E473C-14F2-40BC-9377-2FAB11CA91DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {755E473C-14F2-40BC-9377-2FAB11CA91DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {755E473C-14F2-40BC-9377-2FAB11CA91DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {755E473C-14F2-40BC-9377-2FAB11CA91DC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -104,5 +112,8 @@ Global {9073A593-A2F5-471E-9678-B896A7226FD4} = {F084DDFD-89F3-44F9-89C3-5CA11F4CDEEF} {6F4670CD-6861-47A8-9A02-2B63AD73A929} = {587959C2-5AFA-4B77-B327-566610F9A289} {20A5EBD3-75D1-4E06-8240-09EEF874017A} = {9E41CD5A-271C-4294-AAF9-8EB379311416} + {3E342BAC-EE44-44E4-8E99-393F0C9F787C} = {07B50C44-6D38-474E-87AF-68672D241EEB} + {28B90486-1436-4CD7-88D0-122B6963AB58} = {07B50C44-6D38-474E-87AF-68672D241EEB} + {755E473C-14F2-40BC-9377-2FAB11CA91DC} = {07B50C44-6D38-474E-87AF-68672D241EEB} EndGlobalSection EndGlobal