Linkoid.LethalCompany.Test.Templates 1.0.0

dotnet new install Linkoid.LethalCompany.Test.Templates::1.0.0                
This package contains a .NET Template Package you can call from the shell/command line.

Lethal Company Test Templates

GitHub Stars License

Lethal Company dotnet MSBuild C# SmiteUnit

This package provides several templates for creating test projects for Lethal Company plugins.

Installation

Install the templates using the .NET CLI

dotnet new install Linkoid.LethalCompany.Test.Templates

SmiteUnit Templates

The SmiteUnit templates provide boiler plate code for creating SmiteUnit tests for Lethal Company plugins.

Read more about SmiteUnit here

Starting from Scratch

To start with a completely new plugin project, use the SmiteUnit Plugin template

dotnet new lcsmiteplugin -n MyPlugin

Adding Tests to an Existing Plugin Project

To add tests to an existing plugin project, first create a new SmiteUnit test project for the solution. Specify the name of the plugin for which these tests are being created with the -p argument.

dotnet new lcsmitetests -n MyPlugin.Tests -p MyPlugin

This will create a separate test project next to the plugin project.

Next, navigate inside the plugin project folder, and add the Smite Injection template to the project.

cd ./MyPlugin/
dotnet new lcsmiteinject

This should automatically add the required package, but if it doesn't, it will print instructions on how to add the package references manually.

Finally, a few lines need to added to the plugin class to create and start the injection helper.

public class MyPlugin : BaseUnityPlugin
{
  void Awake()
  {
    // ...
#if DEBUG
    // Create an injection helper using the name of the test assembly
    var injectionHelper = LethalSmiteInjectionHelper.Create("MyPlugin.Tests");

    // Call Start() after creation to start tests immediately
    injectionHelper.Start();

    // Or don't call Start() and tests will automatically start on the next frame.
#endif
    // ...
  }
}
  • .NETStandard 2.0

    • No dependencies.

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
1.0.0 111 9/21/2024