fix: Fixes tests to use C# 11 syntax (#1462)
This commit is contained in:
parent
2c8d54549c
commit
35b7c35167
5 changed files with 37 additions and 13 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<Configurations>Debug;Release;Analyze</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
|
||||
<PackageReference Include="xunit" Version="2.5.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
|
||||
<ProjectReference Include="..\Server\Server.csproj" />
|
||||
|
|
|
|||
|
|
@ -7,10 +7,16 @@ namespace Server.Tests;
|
|||
|
||||
public sealed class PooledRefQueueTests : IDisposable
|
||||
{
|
||||
private class MockedRandomSource(int queueCount, int mockedValue) : IRandomSource
|
||||
private class MockedRandomSource : IRandomSource
|
||||
{
|
||||
private int _queueCount = queueCount;
|
||||
private int _mockedValue = mockedValue;
|
||||
private int _queueCount;
|
||||
private int _mockedValue;
|
||||
|
||||
public MockedRandomSource(int queueCount, int mockedValue)
|
||||
{
|
||||
_queueCount = queueCount;
|
||||
_mockedValue = mockedValue;
|
||||
}
|
||||
|
||||
public int Next() => throw new NotImplementedException();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ namespace Server.Engines.MLQuests;
|
|||
|
||||
public class MLQuestPacketTests
|
||||
{
|
||||
private class MockedRace(
|
||||
private class MockedRace : Race
|
||||
{
|
||||
public MockedRace(
|
||||
int raceID,
|
||||
int raceIndex,
|
||||
string name,
|
||||
|
|
@ -17,8 +19,8 @@ public class MLQuestPacketTests
|
|||
int maleGhostBody,
|
||||
int femaleGhostBody,
|
||||
Expansion requiredExpansion
|
||||
)
|
||||
: Race(raceID,
|
||||
) : base(
|
||||
raceID,
|
||||
raceIndex,
|
||||
name,
|
||||
pluralName,
|
||||
|
|
@ -28,7 +30,9 @@ public class MLQuestPacketTests
|
|||
femaleGhostBody,
|
||||
requiredExpansion
|
||||
)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ValidateHair(bool female, int itemID) => throw new NotImplementedException();
|
||||
|
||||
public override int RandomHair(bool female) => throw new NotImplementedException();
|
||||
|
|
|
|||
|
|
@ -102,19 +102,33 @@ public class BoatPacketTests : IClassFixture<ServerFixture>
|
|||
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||
}
|
||||
|
||||
private class TestBoat(Serial serial, List<IEntity> list, List<IEntity> notContainedList) : BaseBoat(serial)
|
||||
private class TestBoat : BaseBoat
|
||||
{
|
||||
private readonly List<IEntity> _list;
|
||||
private readonly List<IEntity> _notContainedList;
|
||||
|
||||
public TestBoat(Serial serial, List<IEntity> list, List<IEntity> notContainedList) : base(serial)
|
||||
{
|
||||
_list = list;
|
||||
_notContainedList = notContainedList;
|
||||
}
|
||||
|
||||
public override MultiComponentList Components { get; } = new(new List<MultiTileEntry>());
|
||||
|
||||
public override bool Contains(int x, int y) => !notContainedList.Any(e => e.X == x && e.Y == y);
|
||||
public override bool Contains(int x, int y) => !_notContainedList.Any(e => e.X == x && e.Y == y);
|
||||
|
||||
public override MovingEntitiesEnumerable GetMovingEntities(bool includeBoat = false) =>
|
||||
new(this, true, new Map.PooledEnumerable<IEntity>(list));
|
||||
new(this, true, new Map.PooledEnumerable<IEntity>(_list));
|
||||
}
|
||||
|
||||
private class MockedMobile(Serial serial) : Mobile(serial)
|
||||
private class MockedMobile : Mobile
|
||||
{
|
||||
public HashSet<IEntity> CanSeeEntities = new();
|
||||
|
||||
public MockedMobile(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanSee(Mobile m) => m == this;
|
||||
|
||||
public override bool CanSee(Item i) => CanSeeEntities.Contains(i);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<Configurations>Debug;Release;Analyze</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
|
||||
<PackageReference Include="xunit" Version="2.5.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
|
||||
<ProjectReference Include="..\Server\Server.csproj" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue