Skip to content

Commit 9aea508

Browse files
AnonymusNWTSRBerry
authored andcommitted
run dotnet
1 parent 36b6267 commit 9aea508

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

RyuSocks.Test/Auth/UsernameAndPasswordTests.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ public void Authenticate_RegisteredUserAuthentication(string username, string pa
5151
};
5252
usernameAndPassword.Authenticate(null, out ReadOnlySpan<byte> outgoingPacket);
5353
usernameAndPassword.IsClient = false;
54-
usernameAndPassword.Authenticate(outgoingPacket, out ReadOnlySpan<byte> responsePacket);
54+
55+
usernameAndPassword.Authenticate(outgoingPacket, out _);
5556
}
5657

5758
[Theory]
5859
[UsernameAndPasswordRandomUsernameAndPasswords(1)]
5960
public void Authenticate_NotRegisteredUserAuthentication(string username, string password)
6061
{
61-
UsernameAndPassword usernameAndPassword = new(){
62-
Database = new Dictionary<string, string>(),
62+
UsernameAndPassword usernameAndPassword = new()
63+
{
64+
Database = [],
6365
Username = username,
6466
Password = password
6567
};
@@ -71,7 +73,7 @@ public void Authenticate_NotRegisteredUserAuthentication(string username, string
7173
}
7274

7375
[Theory]
74-
[InlineData("RegisteredUser","WrongPassword")]
76+
[InlineData("RegisteredUser", "WrongPassword")]
7577
public void Authenticate_RegisteredUserWrongPasswordAuthentication(string username, string password)
7678
{
7779
UsernameAndPassword usernameAndPassword = new()
@@ -106,9 +108,9 @@ public void Authenticate_RightResponsePacket(string username, string password)
106108
usernameAndPassword.Authenticate(null, out ReadOnlySpan<byte> outgoingPacket);
107109
usernameAndPassword.IsClient = false;
108110
usernameAndPassword.Authenticate(outgoingPacket, out ReadOnlySpan<byte> responsePacket);
109-
111+
110112
byte[] responsePacketBytes = responsePacket.ToArray();
111-
Assert.Equal(usernameAndPasswordResponseBytes,responsePacketBytes );
113+
Assert.Equal(usernameAndPasswordResponseBytes, responsePacketBytes);
112114
}
113115

114116
[Theory]

RyuSocks/Packets/Auth/UsernameAndPassword/UsernameAndPasswordRequest.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public UsernameAndPasswordRequest(byte[] packetBytes)
9393
Bytes = packetBytes;
9494
Version = Bytes[0];
9595
UsernameLength = Bytes[1];
96-
try { Username = Encoding.ASCII.GetString(Bytes[2..(2 + UsernameLength)]); }
96+
try
97+
{ Username = Encoding.ASCII.GetString(Bytes[2..(2 + UsernameLength)]); }
9798
catch (Exception e)
9899
{
99100
throw new InvalidOperationException($"UsernameLength and actual Username length do not match: {Bytes[1]:X} (throws {e})");

0 commit comments

Comments
 (0)