Skip to content

Commit

Permalink
Fix xUnit1048
Browse files Browse the repository at this point in the history
  • Loading branch information
wherewhere committed Jun 4, 2024
1 parent 6791394 commit 987a519
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 148 deletions.
104 changes: 52 additions & 52 deletions AdvancedSharpAdbClient.Tests/AdbClientTests.Async.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Xunit;

namespace AdvancedSharpAdbClient.Tests
Expand All @@ -10,7 +11,7 @@ public partial class AdbCommandLineClientTests
/// Tests the <see cref="AdbCommandLineClient.GetVersionAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetVersionAsyncTest()
public async Task GetVersionAsyncTest()
{
Version adbVersion = new(1, 0, 41);
string fileVersion = "34.0.4-android-tools";
Expand All @@ -29,7 +30,7 @@ public async void GetVersionAsyncTest()
/// Tests the <see cref="AdbCommandLineClient.GetVersionAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetVersionAsyncNullTest()
public async Task GetVersionAsyncNullTest()
{
DummyAdbCommandLineClient commandLine = new()
{
Expand All @@ -42,7 +43,7 @@ public async void GetVersionAsyncNullTest()
/// Tests the <see cref="AdbCommandLineClient.GetVersionAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetOutdatedVersionAsyncTest()
public async Task GetOutdatedVersionAsyncTest()
{
DummyAdbCommandLineClient commandLine = new()
{
Expand All @@ -55,7 +56,7 @@ public async void GetOutdatedVersionAsyncTest()
/// Tests the <see cref="AdbCommandLineClient.StartServerAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncTest()
public async Task StartServerAsyncTest()
{
DummyAdbCommandLineClient commandLine = new();
Assert.False(commandLine.ServerStarted);
Expand Down
27 changes: 14 additions & 13 deletions AdvancedSharpAdbClient.Tests/AdbServerTests.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Xunit;

namespace AdvancedSharpAdbClient.Tests
Expand All @@ -13,7 +14,7 @@ public partial class AdbServerTests
/// Tests the <see cref="AdbServer.GetStatusAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetStatusAsyncNotRunningTest()
public async Task GetStatusAsyncNotRunningTest()
{
IAdbSocket adbSocketMock = Substitute.For<IAdbSocket>();
adbSocketMock.SendAdbRequestAsync("host:version", Arg.Any<CancellationToken>()).Throws(new AggregateException(new SocketException(AdbServer.ConnectionRefused)));
Expand All @@ -29,7 +30,7 @@ public async void GetStatusAsyncNotRunningTest()
/// Tests the <see cref="AdbServer.GetStatusAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetStatusAsyncRunningTest()
public async Task GetStatusAsyncRunningTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("0020");
Expand All @@ -49,7 +50,7 @@ public async void GetStatusAsyncRunningTest()
/// Tests the <see cref="AdbServer.GetStatusAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetStatusAsyncOtherSocketExceptionTest()
public async Task GetStatusAsyncOtherSocketExceptionTest()
{
adbSocketFactory = endPoint => throw new SocketException();

Expand All @@ -62,7 +63,7 @@ public async void GetStatusAsyncOtherSocketExceptionTest()
/// Tests the <see cref="AdbServer.GetStatusAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void GetStatusAsyncOtherExceptionTest()
public async Task GetStatusAsyncOtherExceptionTest()
{
adbSocketFactory = endPoint => throw new Exception();

Expand All @@ -75,7 +76,7 @@ public async void GetStatusAsyncOtherExceptionTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncAlreadyRunningTest()
public async Task StartServerAsyncAlreadyRunningTest()
{
commandLineClient.Version = AdbCommandLineStatus.GetVersionFromOutput(["Android Debug Bridge version 1.0.20"]);
socket.Responses.Enqueue(AdbResponse.OK);
Expand All @@ -93,7 +94,7 @@ public async void StartServerAsyncAlreadyRunningTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncOutdatedRunningNoExecutableTest()
public async Task StartServerAsyncOutdatedRunningNoExecutableTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("0010");
Expand All @@ -106,7 +107,7 @@ public async void StartServerAsyncOutdatedRunningNoExecutableTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncNotRunningNoExecutableTest()
public async Task StartServerAsyncNotRunningNoExecutableTest()
{
adbSocketFactory = endPoint => throw new SocketException(AdbServer.ConnectionRefused);

Expand All @@ -120,7 +121,7 @@ public async void StartServerAsyncNotRunningNoExecutableTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncOutdatedRunningTest()
public async Task StartServerAsyncOutdatedRunningTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("0010");
Expand All @@ -141,7 +142,7 @@ public async void StartServerAsyncOutdatedRunningTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncNotRunningTest()
public async Task StartServerAsyncNotRunningTest()
{
adbSocketFactory = endPoint => throw new SocketException(AdbServer.ConnectionRefused);

Expand All @@ -160,7 +161,7 @@ public async void StartServerAsyncNotRunningTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncIntermediateRestartRequestedRunningTest()
public async Task StartServerAsyncIntermediateRestartRequestedRunningTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("001f");
Expand All @@ -181,7 +182,7 @@ public async void StartServerAsyncIntermediateRestartRequestedRunningTest()
/// Tests the <see cref="AdbServer.StartServerAsync(string, bool, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StartServerAsyncIntermediateRestartNotRequestedRunningTest()
public async Task StartServerAsyncIntermediateRestartNotRequestedRunningTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("001f");
Expand All @@ -201,7 +202,7 @@ public async void StartServerAsyncIntermediateRestartNotRequestedRunningTest()
/// Tests the <see cref="AdbServer.RestartServerAsync(string, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void RestartServerAsyncTest()
public async Task RestartServerAsyncTest()
{
socket.Responses.Enqueue(AdbResponse.OK);
socket.ResponseMessages.Enqueue("001f");
Expand All @@ -222,7 +223,7 @@ public async void RestartServerAsyncTest()
/// Tests the <see cref="AdbServer.StopServerAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void StopServerAsyncTest()
public async Task StopServerAsyncTest()
{
await adbServer.StopServerAsync();

Expand Down
24 changes: 12 additions & 12 deletions AdvancedSharpAdbClient.Tests/AdbSocketTests.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class AdbSocketTests
/// Tests the <see cref="AdbSocket.SendSyncRequestAsync(SyncCommand, int, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void SendSyncDATARequestAsyncTest() =>
public async Task SendSyncDATARequestAsyncTest() =>
await RunTestAsync(
socket => socket.SendSyncRequestAsync(SyncCommand.DATA, 2, default),
[(byte)'D', (byte)'A', (byte)'T', (byte)'A', 2, 0, 0, 0]);
Expand All @@ -22,7 +22,7 @@ await RunTestAsync(
/// Tests the <see cref="AdbSocket.SendSyncRequestAsync(SyncCommand, string, UnixFileStatus, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void SendSyncSENDRequestAsyncTest() =>
public async Task SendSyncSENDRequestAsyncTest() =>
await RunTestAsync(
socket => socket.SendSyncRequestAsync(SyncCommand.SEND, "/test", UnixFileStatus.GroupMask | UnixFileStatus.StickyBit | UnixFileStatus.UserExecute | UnixFileStatus.OtherExecute, default),
[(byte)'S', (byte)'E', (byte)'N', (byte)'D', 9, 0, 0, 0, (byte)'/', (byte)'t', (byte)'e', (byte)'s', (byte)'t', (byte)',', (byte)'6', (byte)'3', (byte)'3']);
Expand All @@ -31,7 +31,7 @@ await RunTestAsync(
/// Tests the <see cref="AdbSocket.SendSyncRequestAsync(SyncCommand, string, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void SendSyncDENTRequestAsyncTest() =>
public async Task SendSyncDENTRequestAsyncTest() =>
await RunTestAsync(
socket => socket.SendSyncRequestAsync(SyncCommand.DENT, "/data", default),
[(byte)'D', (byte)'E', (byte)'N', (byte)'T', 5, 0, 0, 0, (byte)'/', (byte)'d', (byte)'a', (byte)'t', (byte)'a']);
Expand All @@ -40,15 +40,15 @@ await RunTestAsync(
/// Tests the <see cref="AdbSocket.SendSyncRequestAsync(SyncCommand, string, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void SendSyncNullRequestAsyncTest() =>
public async Task SendSyncNullRequestAsyncTest() =>
_ = await Assert.ThrowsAsync<ArgumentNullException>(() =>
RunTestAsync(socket => socket.SendSyncRequestAsync(SyncCommand.DATA, null, default), []));

/// <summary>
/// Tests the <see cref="AdbSocket.ReadSyncResponseAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadSyncResponseAsync()
public async Task ReadSyncResponseAsync()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand All @@ -67,7 +67,7 @@ public async void ReadSyncResponseAsync()
/// Tests the <see cref="AdbSocket.ReadStringAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadStringAsyncTest()
public async Task ReadStringAsyncTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand All @@ -88,7 +88,7 @@ public async void ReadStringAsyncTest()
/// Tests the <see cref="AdbSocket.ReadSyncStringAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadSyncStringAsyncTest()
public async Task ReadSyncStringAsyncTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand All @@ -109,7 +109,7 @@ public async void ReadSyncStringAsyncTest()
/// Tests the <see cref="AdbSocket.ReadAdbResponseAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadAdbOkayResponseAsyncTest()
public async Task ReadAdbOkayResponseAsyncTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand All @@ -132,7 +132,7 @@ public async void ReadAdbOkayResponseAsyncTest()
/// Tests the <see cref="AdbSocket.ReadAdbResponseAsync(CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadAdbFailResponseAsyncTest()
public async Task ReadAdbFailResponseAsyncTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand All @@ -153,7 +153,7 @@ public async void ReadAdbFailResponseAsyncTest()
/// Tests the <see cref="AdbSocket.ReadAsync(byte[], int, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadAsyncTest()
public async Task ReadAsyncTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand Down Expand Up @@ -185,7 +185,7 @@ public async void ReadAsyncTest()
/// Tests the <see cref="AdbSocket.ReadAsync(Memory{byte}, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void ReadAsyncMemoryTest()
public async Task ReadAsyncMemoryTest()
{
using DummyTcpSocket tcpSocket = new();
using AdbSocket socket = new(tcpSocket);
Expand Down Expand Up @@ -217,7 +217,7 @@ public async void ReadAsyncMemoryTest()
/// Tests the <see cref="AdbSocket.SendAdbRequestAsync(string, CancellationToken)"/> method.
/// </summary>
[Fact]
public async void SendAdbRequestAsyncTest() =>
public async Task SendAdbRequestAsyncTest() =>
await RunTestAsync(
socket => socket.SendAdbRequestAsync("Test", default),
"0004Test"u8.ToArray());
Expand Down
Loading

0 comments on commit 987a519

Please sign in to comment.