Surity.BepInEx
2.1.2
See the version list below for details.
dotnet add package Surity.BepInEx --version 2.1.2
NuGet\Install-Package Surity.BepInEx -Version 2.1.2
<PackageReference Include="Surity.BepInEx" Version="2.1.2" />
paket add Surity.BepInEx --version 2.1.2
#r "nuget: Surity.BepInEx, 2.1.2"
// Install Surity.BepInEx as a Cake Addin #addin nuget:?package=Surity.BepInEx&version=2.1.2 // Install Surity.BepInEx as a Cake Tool #tool nuget:?package=Surity.BepInEx&version=2.1.2
Surity
Unit-testing framework for Unity mods.
Writing tests
using Surity;
using System.Collections.Generic;
// Only test classes with Only = true are run.
// Test classes with Skip = true are skipped.
[TestClass(Only = false, Skip = false)]
public class MyTests
{
// BeforeAll, AfterAll, BeforeEach and AfterEach can be inherited
[BeforeAll]
public void SetUp()
{
// Ran before all tests in this class
}
[AfterAll]
public void TearDown()
{
// Ran after all tests in this class
}
[BeforeEach]
public void TestSetUp()
{
// Ran before each test in this class
}
[AfterEach]
public void TestTearDown()
{
// Ran after each test in this class
}
// Across all test classes, only tests with Only = true are run.
// Tests with Skip = true are skipped.
[Test(Only = false, Skip = false)]
public void TestSomething()
{
// Throw an error to fail. Use your favourite assertion library
}
// Tests and setup methods (BeforeEach, AfterEach, etc.) can also return IEnumerator
[Test]
public IEnumerator TestSomething()
{
yield break;
}
// Tests can be generated programmatically. Just return the generated tests.
// `Only` and `Skip` apply to generated tests.
[TestGenerator(Only = false, Skip = false)]
public IEnumerable<TestInfo> GenerateTests()
{
void Func1(int num) {
// Works like normal tests
}
IEnumerator Func2(int num) {
// Generated tests can also return IEnumerator, as you would expect
}
yield return new TestInfo("Name of test1", () => Func1(1));
yield return new TestInfo("Name of test2", () => Func2(2));
}
}
Running tests
Tests must be run inside the game if they depend on the Unity runtime.
If you use the BepInEx modding framework, you can add the Surity.BepInEx
NuGet package to your test project. The package contains a BepInEx plugin which makes sure all loaded Surity tests are ran only once. The plugin only runs tests if the game was started with the Surity CLI program.
Refer to Surity.BepInEx.cs
on how to invoke the test runner manually. Add the Surity.Core
NuGet package to your test project if you don't need Surity.BepInEx
.
Using Surity CLI
Run tests with the standalone Surity.exe executable or by installing the dotnet tool:
$ dotnet tool install Surity.CLI
$ dotnet surity <path-to-game-exe> [options] [-- arguments]
The program runs the game in batchmode and listens for test results.
Any arguments after --
are passed to the game. For example in
$ dotnet surity <path-to-game-exe> -- -nolog
the -nolog
argument is passed to the game executable.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.1
- Surity.Core (>= 2.1.2)
- ThisAssembly.Project (>= 1.0.0)
-
.NETFramework 4.7.2
- Surity.Core (>= 2.1.2)
- ThisAssembly.Project (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.2.0 | 343 | 5/21/2023 |
2.1.4 | 170 | 5/21/2023 |
2.1.3 | 204 | 4/26/2023 |
2.1.2 | 222 | 4/24/2023 |
2.1.1 | 221 | 4/16/2023 |
2.1.0 | 205 | 4/15/2023 |
2.0.1 | 217 | 4/5/2023 |
2.0.0 | 198 | 4/4/2023 |
1.1.2 | 226 | 3/27/2023 |
1.1.1 | 232 | 3/21/2023 |
1.1.0 | 250 | 3/21/2023 |
1.0.4 | 259 | 3/10/2023 |
1.0.3 | 276 | 3/9/2023 |
1.0.2 | 278 | 3/9/2023 |
1.0.1 | 261 | 3/8/2023 |
1.0.0 | 273 | 3/6/2023 |