ModernUO/Projects/UOContent.Tests/Tests/Engines/ML Quests/MLQuestPacketTests.cs
Kamron Batman bde5357f89
fix: Removes Moq due to privacy concerns (#1445)
Due to privacy/security concerns, Moq has been removed.

See: https://github.com/moq/moq/issues/1372
2023-08-09 08:12:45 -07:00

86 lines
2.4 KiB
C#

using System;
using Server.Tests;
using Server.Tests.Network;
using Xunit;
namespace Server.Engines.MLQuests;
public class MLQuestPacketTests
{
private class MockedRace(
int raceID,
int raceIndex,
string name,
string pluralName,
int maleBody,
int femaleBody,
int maleGhostBody,
int femaleGhostBody,
Expansion requiredExpansion
)
: Race(raceID,
raceIndex,
name,
pluralName,
maleBody,
femaleBody,
maleGhostBody,
femaleGhostBody,
requiredExpansion
)
{
public override bool ValidateHair(bool female, int itemID) => throw new NotImplementedException();
public override int RandomHair(bool female) => throw new NotImplementedException();
public override bool ValidateFacialHair(bool female, int itemID) => throw new NotImplementedException();
public override int RandomFacialHair(bool female) => throw new NotImplementedException();
public override int ClipSkinHue(int hue) => throw new NotImplementedException();
public override int RandomSkinHue() => throw new NotImplementedException();
public override int ClipHairHue(int hue) => throw new NotImplementedException();
public override int RandomHairHue() => throw new NotImplementedException();
}
[Theory]
[InlineData(true, 1)]
[InlineData(false, 2)]
public void TestRaceChanger(bool female, int raceId)
{
var race = new MockedRace(
raceId,
0,
"Test Race",
"Test Races",
0x1,
0x2,
0x3,
0x4,
Expansion.None
);
var expected = new RaceChanger(female, race).Compile();
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendRaceChanger(female, race);
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
}
[Fact]
public void TestCloseRaceChanger()
{
var expected = new CloseRaceChanger().Compile();
var ns = PacketTestUtilities.CreateTestNetState();
ns.SendCloseRaceChanger();
var result = ns.SendPipe.Reader.TryRead();
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
}
}