mirror of
https://github.com/kwsch/NHSE.git
synced 2026-07-11 15:26:28 -05:00
Add xunit test project
ensures item sizes are correctly marshalling
This commit is contained in:
parent
da4b292588
commit
61a7fa2dbf
|
|
@ -7,7 +7,7 @@ namespace NHSE.Core
|
|||
/// <summary>
|
||||
/// Logic for converting raw data to class/stack struct, and back to data.
|
||||
/// </summary>
|
||||
internal static class StructConverter
|
||||
public static class StructConverter
|
||||
{
|
||||
public static T ToStructure<T>(this byte[] bytes) where T : struct
|
||||
{
|
||||
|
|
|
|||
25
NHSE.Tests/ItemTests.cs
Normal file
25
NHSE.Tests/ItemTests.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using FluentAssertions;
|
||||
using NHSE.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace NHSE.Tests
|
||||
{
|
||||
public class ItemTests
|
||||
{
|
||||
[Fact]
|
||||
public void ItemMarshal()
|
||||
{
|
||||
var item = new Item();
|
||||
var bytes = item.ToBytesClass();
|
||||
bytes.Length.Should().Be(Item.SIZE);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void VillagerItemMarshal()
|
||||
{
|
||||
var item = new VillagerItem();
|
||||
var bytes = item.ToBytesClass();
|
||||
bytes.Length.Should().Be(VillagerItem.SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
NHSE.Tests/NHSE.Tests.csproj
Normal file
23
NHSE.Tests/NHSE.Tests.csproj
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NHSE.Core\NHSE.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
NHSE.sln
6
NHSE.sln
|
|
@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHSE.Sprites", "NHSE.Sprite
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHSE.Parsing", "NHSE.Parsing\NHSE.Parsing.csproj", "{D6E5CE99-6182-49BA-AD8D-EC12E90A20E3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHSE.Tests", "NHSE.Tests\NHSE.Tests.csproj", "{AD3412A3-74EA-443D-BB07-B36E39D5166F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -33,6 +35,10 @@ Global
|
|||
{D6E5CE99-6182-49BA-AD8D-EC12E90A20E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D6E5CE99-6182-49BA-AD8D-EC12E90A20E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D6E5CE99-6182-49BA-AD8D-EC12E90A20E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD3412A3-74EA-443D-BB07-B36E39D5166F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD3412A3-74EA-443D-BB07-B36E39D5166F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD3412A3-74EA-443D-BB07-B36E39D5166F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD3412A3-74EA-443D-BB07-B36E39D5166F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user