chore: Use var everywhere (#2294)
This commit is contained in:
parent
0b34cc4417
commit
ebaf104935
267 changed files with 873 additions and 873 deletions
|
|
@ -188,7 +188,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadAsciiString()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hello"u8;
|
||||
var buffer = "Hello"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadAscii();
|
||||
|
|
@ -200,7 +200,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadAsciiStringWithNull()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hel\0o"u8;
|
||||
var buffer = "Hel\0o"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadAscii();
|
||||
|
|
@ -212,7 +212,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadAsciiStringFixedLength()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hello\0\0\0\0\0"u8;
|
||||
var buffer = "Hello\0\0\0\0\0"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadAscii(10);
|
||||
|
|
@ -227,7 +227,7 @@ public class SpanReaderTests
|
|||
Assert.Throws<EndOfStreamException>(
|
||||
() =>
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hel"u8;
|
||||
var buffer = "Hel"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
reader.ReadAscii(10);
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadUTF8String()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hello"u8;
|
||||
var buffer = "Hello"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadUTF8();
|
||||
|
|
@ -261,7 +261,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadUTF8StringWithNull()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "Hi\0Bye"u8;
|
||||
var buffer = "Hi\0Bye"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadUTF8();
|
||||
|
|
@ -273,7 +273,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadLittleUniString()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "H\0i\0"u8;
|
||||
var buffer = "H\0i\0"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadLittleUni();
|
||||
|
|
@ -285,7 +285,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadLittleUniStringWithNull()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "H\0i\0\0\0X\0"u8;
|
||||
var buffer = "H\0i\0\0\0X\0"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadLittleUni();
|
||||
|
|
@ -297,7 +297,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadLittleUniStringFixedLength()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "H\0i\0\0\0\0\0"u8;
|
||||
var buffer = "H\0i\0\0\0\0\0"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadLittleUni(4);
|
||||
|
|
@ -321,7 +321,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadBigUniString()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "\0H\0i"u8;
|
||||
var buffer = "\0H\0i"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadBigUni();
|
||||
|
|
@ -333,7 +333,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadBigUniStringWithNull()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "\0H\0i\0\0\0X"u8;
|
||||
var buffer = "\0H\0i\0\0\0X"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadBigUni();
|
||||
|
|
@ -345,7 +345,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadBigUniStringFixedLength()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "\0H\0i\0\0\0\0"u8;
|
||||
var buffer = "\0H\0i\0\0\0\0"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
var result = reader.ReadBigUni(4);
|
||||
|
|
@ -560,7 +560,7 @@ public class SpanReaderTests
|
|||
[Fact]
|
||||
public void TestReadMultipleStringsWithNullTerminators()
|
||||
{
|
||||
ReadOnlySpan<byte> buffer = "AB\0CD\0EF"u8;
|
||||
var buffer = "AB\0CD\0EF"u8;
|
||||
var reader = new SpanReader(buffer);
|
||||
|
||||
Assert.Equal("AB", reader.ReadAscii());
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class OrderedSetTests
|
|||
Assert.True(set.Contains(4));
|
||||
Assert.False(set.Contains(8));
|
||||
|
||||
int index = 0;
|
||||
var index = 0;
|
||||
foreach (var value in set)
|
||||
{
|
||||
Assert.Equal(expected[index++], value);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class Point2DTests
|
|||
[Fact]
|
||||
public void TestPoint2DTryFormatSucceeds()
|
||||
{
|
||||
char[] array = new char[128];
|
||||
var array = new char[128];
|
||||
|
||||
var p1 = new Point2D(0, 0);
|
||||
Assert.True(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
@ -44,7 +44,7 @@ public class Point2DTests
|
|||
[Fact]
|
||||
public void TestPoint2DTryFormatFails()
|
||||
{
|
||||
char[] array = new char[1];
|
||||
var array = new char[1];
|
||||
|
||||
var p1 = new Point2D(0, 0);
|
||||
Assert.False(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class Point3DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[128];
|
||||
var array = new char[128];
|
||||
|
||||
var p1 = new Point3D(0, 0, 0);
|
||||
Assert.True(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
@ -59,7 +59,7 @@ public class Point3DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[1];
|
||||
var array = new char[1];
|
||||
|
||||
var p1 = new Point3D(0, 0, 0);
|
||||
Assert.False(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class Rectangle2DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[128];
|
||||
var array = new char[128];
|
||||
|
||||
var p1 = new Rectangle2D(0, 0, 0, 0);
|
||||
Assert.True(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
@ -48,7 +48,7 @@ public class Rectangle2DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[1];
|
||||
var array = new char[1];
|
||||
|
||||
var p1 = new Rectangle2D(0, 0, 0, 0);
|
||||
Assert.False(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class Rectangle3DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[128];
|
||||
var array = new char[128];
|
||||
|
||||
var p1 = new Rectangle3D(0, 0, 0, 0, 0, 0);
|
||||
Assert.True(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
@ -48,7 +48,7 @@ public class Rectangle3DTests
|
|||
{
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[1];
|
||||
var array = new char[1];
|
||||
|
||||
var p1 = new Rectangle3D(0, 0, 0, 0, 0, 0);
|
||||
Assert.False(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public sealed class WorldLocationTests
|
|||
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[128];
|
||||
var array = new char[128];
|
||||
|
||||
var p1 = new WorldLocation(0, 0, 0, map);
|
||||
Assert.True(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
@ -82,7 +82,7 @@ public sealed class WorldLocationTests
|
|||
|
||||
const int max = int.MaxValue;
|
||||
const int min = int.MinValue;
|
||||
char[] array = new char[1];
|
||||
var array = new char[1];
|
||||
|
||||
var p1 = new WorldLocation(0, 0, 0, map);
|
||||
Assert.False(p1.TryFormat(array, out var cp1, null, null));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class ContainerTests
|
|||
|
||||
container2.AddItem(static1);
|
||||
|
||||
List<Static> statics = new List<Static>();
|
||||
var statics = new List<Static>();
|
||||
foreach (var item in container.FindItemsByType<Static>())
|
||||
{
|
||||
statics.Add(item);
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ public class ItemByDistanceEnumeratorTests
|
|||
for (var side = 0; side < 4; side++)
|
||||
{
|
||||
var offset = ringOffset * Map.SectorSize;
|
||||
Point3D pos = side switch
|
||||
var pos = side switch
|
||||
{
|
||||
0 => new Point3D(center.X + offset, center.Y, 0),
|
||||
1 => new Point3D(center.X, center.Y + offset, 0),
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ namespace Server.Tests.Tests.Maps
|
|||
};
|
||||
|
||||
// When
|
||||
string serialized = JsonConfig.Serialize(mapConfig);
|
||||
TestMapConfig deserialized = JsonSerializer.Deserialize<TestMapConfig>(serialized, JsonConfig.GetOptions());
|
||||
var serialized = JsonConfig.Serialize(mapConfig);
|
||||
var deserialized = JsonSerializer.Deserialize<TestMapConfig>(serialized, JsonConfig.GetOptions());
|
||||
|
||||
// Then
|
||||
Assert.Equal(mapConfig.TestMapFlags, deserialized.TestMapFlags);
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ public class MobileByDistanceEnumeratorTests
|
|||
for (var side = 0; side < 4; side++)
|
||||
{
|
||||
var offset = ringOffset * Map.SectorSize;
|
||||
Point3D pos = side switch
|
||||
var pos = side switch
|
||||
{
|
||||
0 => new Point3D(center.X + offset, center.Y, 0),
|
||||
1 => new Point3D(center.X, center.Y + offset, 0),
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class FirewallTests
|
|||
var entry = new SingleIpFirewallEntry("172.16.0.1");
|
||||
Firewall.Add(entry);
|
||||
|
||||
bool found = false;
|
||||
var found = false;
|
||||
Firewall.ReadFirewallSet(set =>
|
||||
{
|
||||
found = set.Contains(entry);
|
||||
|
|
@ -86,8 +86,8 @@ public class FirewallTests
|
|||
[Fact]
|
||||
public void Firewall_IsThreadSafe()
|
||||
{
|
||||
IPAddress[] testIps = new IPAddress[256];
|
||||
for (int i = 0; i <= 255; i++)
|
||||
var testIps = new IPAddress[256];
|
||||
for (var i = 0; i <= 255; i++)
|
||||
{
|
||||
testIps[i] = IPAddress.Parse($"192.168.0.{i}");
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ public class FirewallTests
|
|||
|
||||
Parallel.ForEach(testIps, ip =>
|
||||
{
|
||||
bool shouldBlock = int.Parse(ip.ToString().Split('.')[3]) is > 0;
|
||||
var shouldBlock = int.Parse(ip.ToString().Split('.')[3]) is > 0;
|
||||
Assert.Equal(shouldBlock, Firewall.IsBlocked(ip));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestSwing()
|
||||
{
|
||||
Serial attacker = (Serial)0x1024;
|
||||
Serial defender = (Serial)0x2048;
|
||||
var attacker = (Serial)0x1024;
|
||||
var defender = (Serial)0x2048;
|
||||
|
||||
var expected = new Swing(attacker, defender).Compile();
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestChangeCombatant()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
|
||||
var expected = new ChangeCombatant(serial).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestContainerDisplay()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort gumpId = 100;
|
||||
|
||||
var expected = new ContainerDisplay(serial, gumpId).Compile();
|
||||
|
|
@ -26,7 +26,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestContainerDisplayHS()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort gumpId = 100;
|
||||
|
||||
var expected = new ContainerDisplayHS(serial, gumpId).Compile();
|
||||
|
|
@ -42,7 +42,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestDisplaySpellbook()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
|
||||
var expected = new DisplaySpellbook(serial).Compile();
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestDisplaySpellbookHS()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
|
||||
var expected = new DisplaySpellbookHS(serial).Compile();
|
||||
|
||||
|
|
@ -71,11 +71,11 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestNewSpellbookContent()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort graphic = 100;
|
||||
ushort offset = 10;
|
||||
ulong content = 0x123456789ABCDEF0;
|
||||
bool opl = ObjectPropertyList.Enabled;
|
||||
var opl = ObjectPropertyList.Enabled;
|
||||
|
||||
var expected = new NewSpellbookContent(serial, graphic, offset, content).Compile();
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestSpellbookContent()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort offset = 10;
|
||||
ushort graphic = 100;
|
||||
ulong content = 0x123456789ABCDEF0;
|
||||
|
|
@ -109,7 +109,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestSpellbookContent6017()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort offset = 10;
|
||||
ushort graphic = 100;
|
||||
ulong content = 0x123456789ABCDEF0;
|
||||
|
|
@ -127,7 +127,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestContainerContentUpdate()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var item = new Item(serial);
|
||||
|
||||
var expected = new ContainerContentUpdate(item).Compile();
|
||||
|
|
@ -142,7 +142,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestContainerContentUpdate6017()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var item = new Item(serial);
|
||||
|
||||
var expected = new ContainerContentUpdate6017(item).Compile();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class DamagePacketTests
|
|||
[Theory, InlineData(10), InlineData(-5), InlineData(1024)]
|
||||
public void TestDamagePacketOld(int inputAmount)
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
|
||||
var expected = new DamagePacketOld(serial, inputAmount).Compile();
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ public class DamagePacketTests
|
|||
[Theory, InlineData(10), InlineData(-5), InlineData(1024), InlineData(100000)]
|
||||
public void TestDamage(int inputAmount)
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
|
||||
var expected = new DamagePacket(serial, inputAmount).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ namespace Server.Tests.Network
|
|||
public void TestParticleEffect()
|
||||
{
|
||||
var effectType = EffectType.Moving;
|
||||
Serial serial = (Serial)0x4000;
|
||||
Serial from = (Serial)0x1000;
|
||||
Serial to = (Serial)0x2000;
|
||||
var serial = (Serial)0x4000;
|
||||
var from = (Serial)0x1000;
|
||||
var to = (Serial)0x2000;
|
||||
var itemId = 0x100;
|
||||
var fromPoint = new Point3D(1000, 100, -10);
|
||||
var toPoint = new Point3D(1500, 500, 0);
|
||||
|
|
@ -63,8 +63,8 @@ namespace Server.Tests.Network
|
|||
public void TestHuedEffect()
|
||||
{
|
||||
var effectType = EffectType.Moving;
|
||||
Serial from = (Serial)0x1000;
|
||||
Serial to = (Serial)0x2000;
|
||||
var from = (Serial)0x1000;
|
||||
var to = (Serial)0x2000;
|
||||
var itemId = 0x100;
|
||||
var fromPoint = new Point3D(1000, 100, -10);
|
||||
var toPoint = new Point3D(1500, 500, 0);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class GumpPacketTests
|
|||
[Fact]
|
||||
public void TestDisplaySignGump()
|
||||
{
|
||||
Serial gumpSerial = (Serial)0x1000;
|
||||
var gumpSerial = (Serial)0x1000;
|
||||
const int gumpId = 100;
|
||||
const string unknownString = "This is an unknown string";
|
||||
const string caption = "This is a caption";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class ItemPacketTests
|
|||
[Fact]
|
||||
public void TestWorldItemPacket()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var itemId = 1;
|
||||
|
||||
// Move to fixture
|
||||
|
|
@ -45,7 +45,7 @@ public class ItemPacketTests
|
|||
[Fact]
|
||||
public void TestWorldItemSAPacket()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
ushort itemId = 1;
|
||||
|
||||
// Move to fixture
|
||||
|
|
@ -81,7 +81,7 @@ public class ItemPacketTests
|
|||
[Fact]
|
||||
public void TestWorldItemHSPacket()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var itemId = 1;
|
||||
|
||||
// Move to fixture
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestPersonalLightLevel()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
byte lightLevel = 5;
|
||||
var expected = new PersonalLightLevel(serial, lightLevel).Compile();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestMessageLocalized()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var graphic = 0x100;
|
||||
var messageType = MessageType.Label;
|
||||
var hue = 1024;
|
||||
|
|
@ -48,7 +48,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestMessageLocalizedAffix()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var graphic = 0x100;
|
||||
var messageType = MessageType.Label;
|
||||
var hue = 1024;
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestAsciiMessage()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var graphic = 0x100;
|
||||
var messageType = MessageType.Label;
|
||||
var hue = 1024;
|
||||
|
|
@ -131,7 +131,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestUnicodeMessage()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
var serial = (Serial)0x1024;
|
||||
var graphic = 0x100;
|
||||
var messageType = MessageType.Label;
|
||||
var hue = 1024;
|
||||
|
|
@ -171,8 +171,8 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestFollowMessage()
|
||||
{
|
||||
Serial serial = (Serial)0x1024;
|
||||
Serial serial2 = (Serial)0x2;
|
||||
var serial = (Serial)0x1024;
|
||||
var serial2 = (Serial)0x2;
|
||||
|
||||
var expected = new FollowMessage(serial, serial2).Compile();
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ namespace Server.Tests.Network
|
|||
[Fact]
|
||||
public void TestObjectHelpResponse()
|
||||
{
|
||||
Serial s = (Serial)0x100;
|
||||
var s = (Serial)0x100;
|
||||
var text = "This is some testing text";
|
||||
|
||||
var expected = new ObjectHelpResponse(s, text).Compile();
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ public class MobilePacketTests
|
|||
[Fact]
|
||||
public void TestDeathAnimation()
|
||||
{
|
||||
Serial killed = (Serial)0x1;
|
||||
Serial corpse = (Serial)0x1000;
|
||||
var killed = (Serial)0x1;
|
||||
var corpse = (Serial)0x1000;
|
||||
|
||||
var expected = new DeathAnimation(killed, corpse).Compile();
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ public class MobilePacketTests
|
|||
[Fact]
|
||||
public void TestBondStatus()
|
||||
{
|
||||
Serial petSerial = (Serial)0x1;
|
||||
var petSerial = (Serial)0x1;
|
||||
const bool bonded = true;
|
||||
|
||||
var expected = new BondedStatus(petSerial, bonded).Compile();
|
||||
|
|
@ -79,7 +79,7 @@ public class MobilePacketTests
|
|||
[InlineData(10, 100, 25, true, false, 0)]
|
||||
public void TestMobileAnimation(int action, int frameCount, int repeatCount, bool reverse, bool repeat, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
var mobile = (Serial)0x1;
|
||||
|
||||
var expected = new MobileAnimation(
|
||||
mobile,
|
||||
|
|
@ -111,7 +111,7 @@ public class MobilePacketTests
|
|||
[InlineData(10, 100, 20)]
|
||||
public void TestNewMobileAnimation(int action, int frameCount, byte delay)
|
||||
{
|
||||
Serial mobile = (Serial)0x1;
|
||||
var mobile = (Serial)0x1;
|
||||
|
||||
var expected = new NewMobileAnimation(
|
||||
mobile,
|
||||
|
|
@ -490,7 +490,7 @@ public class MobilePacketTests
|
|||
[Fact]
|
||||
public void TestRemoveEntity()
|
||||
{
|
||||
Serial e = (Serial)0x1000;
|
||||
var e = (Serial)0x1000;
|
||||
var expected = new RemoveEntity(e).Compile();
|
||||
|
||||
var ns = PacketTestUtilities.CreateTestNetState();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class DecimalSerializationTests
|
|||
public void TestSerializeDecimal(decimal value)
|
||||
{
|
||||
// Arrange
|
||||
byte[] buffer = new byte[sizeof(decimal)];
|
||||
var buffer = new byte[sizeof(decimal)];
|
||||
|
||||
// Act
|
||||
Write(buffer, value);
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ public class TypeConverterTests
|
|||
public void TestReadAfterWrite()
|
||||
{
|
||||
// Arrange
|
||||
Type itemType = typeof(Item);
|
||||
var itemType = typeof(Item);
|
||||
|
||||
JsonSerializerOptions options = new JsonSerializerOptions();
|
||||
var options = new JsonSerializerOptions();
|
||||
|
||||
TypeConverter converter = new TypeConverter();
|
||||
var converter = new TypeConverter();
|
||||
var bufferWriter = new ArrayBufferWriter<byte>();
|
||||
using var jsonWriter = new Utf8JsonWriter(bufferWriter);
|
||||
converter.Write(jsonWriter, itemType, options);
|
||||
|
|
@ -28,11 +28,11 @@ public class TypeConverterTests
|
|||
jsonWriter.Flush();
|
||||
var jsonData = bufferWriter.WrittenSpan;
|
||||
|
||||
Utf8JsonReader jsonReader = new Utf8JsonReader(jsonData);
|
||||
var jsonReader = new Utf8JsonReader(jsonData);
|
||||
jsonReader.Read();
|
||||
|
||||
// Assert
|
||||
Type readType = converter.Read(ref jsonReader, typeof(Type), options);
|
||||
var readType = converter.Read(ref jsonReader, typeof(Type), options);
|
||||
Assert.Equal(typeof(Item), readType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class TimerTests
|
|||
|
||||
var tickCount = expectedTicks / 8;
|
||||
|
||||
for (int i = 1; i <= tickCount; i++)
|
||||
for (var i = 1; i <= tickCount; i++)
|
||||
{
|
||||
timerTicks.Ticks = i * 8;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ public class TimerTests
|
|||
|
||||
var tickCount = (expectedDelayTicks + (expectedIntervalTicks * count - 1)) / 8;
|
||||
|
||||
for (int i = 1; i <= tickCount; i++)
|
||||
for (var i = 1; i <= tickCount; i++)
|
||||
{
|
||||
timerTicks.Ticks = i * 8;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ public class VirtualSerialTests
|
|||
public void TestNewVirtualGetsAndRollover()
|
||||
{
|
||||
// Acquire virtual serials until we hit the max
|
||||
Serial lastSerial = World.NewVirtual;
|
||||
var lastSerial = World.NewVirtual;
|
||||
do
|
||||
{
|
||||
Serial virtualSerial = World.NewVirtual;
|
||||
var virtualSerial = World.NewVirtual;
|
||||
Assert.Equal(lastSerial + 1, virtualSerial);
|
||||
lastSerial = (Serial) (uint) virtualSerial;
|
||||
} while (lastSerial != World.MaxVirtualSerial);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue