mirror of
https://github.com/space-wizards/RobustToolboxTemplateSingleplayer.git
synced 2026-10-24 05:32:56 -04:00
Fix build and add tests (#6)
Some checks failed
Build & Test / build (ubuntu-latest) (push) Has been cancelled
Some checks failed
Build & Test / build (ubuntu-latest) (push) Has been cancelled
This commit is contained in:
parent
750039957c
commit
3c4568c59e
6 changed files with 138 additions and 16 deletions
40
Template.Tests/StartupTest.cs
Normal file
40
Template.Tests/StartupTest.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using NUnit.Framework;
|
||||
using Robust.Client;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.UnitTesting;
|
||||
using Template.Game;
|
||||
|
||||
namespace Template.Tests;
|
||||
|
||||
[TestFixture]
|
||||
public sealed class StartupTest : RobustIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task GameStartsSingleplayer()
|
||||
{
|
||||
var client = StartClient(new ClientIntegrationOptions
|
||||
{
|
||||
ContentStart = true,
|
||||
ContentAssemblies = [typeof(EntryPoint).Assembly],
|
||||
Options = new GameControllerOptions
|
||||
{
|
||||
ContentModulePrefix = "Template.",
|
||||
ContentBuildDirectory = "Template.Game",
|
||||
LoadConfigAndUserData = false,
|
||||
LoadContentResources = false,
|
||||
},
|
||||
});
|
||||
|
||||
await client.WaitIdleAsync();
|
||||
|
||||
Assert.That(client.IsAlive, Is.True);
|
||||
Assert.That(client.UnhandledException, Is.Null);
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
var baseClient = IoCManager.Resolve<IBaseClient>();
|
||||
|
||||
Assert.That(baseClient.RunLevel, Is.EqualTo(ClientRunLevel.SinglePlayerGame));
|
||||
});
|
||||
}
|
||||
}
|
||||
24
Template.Tests/Template.Tests.csproj
Normal file
24
Template.Tests/Template.Tests.csproj
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<WarningsAsErrors>nullable</WarningsAsErrors>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>..\bin\Template.Tests\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="NUnit" />
|
||||
<PackageReference Include="NUnit3TestAdapter" />
|
||||
<PackageReference Include="NUnit.Analyzers" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Template.Game\Template.Game.csproj" />
|
||||
<ProjectReference Include="..\RobustToolbox\Robust.UnitTesting\Robust.UnitTesting.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue