This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathDummyAdbServer.cs
60 lines (52 loc) · 1.6 KB
/
DummyAdbServer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Net;
namespace SharpAdbClient.Tests
{
/// <summary>
/// A mock implementation of the <see cref="IAdbServer"/> class.
/// </summary>
internal class DummyAdbServer : IAdbServer
{
/// <inheritdoc/>
/// <remarks>
/// The value is set to a value different from the default adb end point, to detect the dummy
/// server being used.
/// </remarks>
public EndPoint EndPoint
{ get; set; } = new IPEndPoint(IPAddress.Loopback, 9999);
/// <summary>
/// Gets or sets the status as is to be reported by the <see cref="DummyAdbServer"/>.
/// </summary>
public AdbServerStatus Status
{ get; set; }
/// <summary>
/// Gets a value indicating whether the server was restarted.
/// </summary>
public bool WasRestarted
{ get; private set; }
/// <inheritdoc/>
public AdbServerStatus GetStatus()
{
return this.Status;
}
/// <inheritdoc/>
public void RestartServer()
{
this.WasRestarted = true;
}
/// <inheritdoc/>
public StartServerResult StartServer(string adbPath, bool restartServerIfNewer)
{
if (this.Status.IsRunning == true)
{
return StartServerResult.AlreadyRunning;
}
this.Status = new AdbServerStatus()
{
IsRunning = true,
Version = new Version(1, 0, 20)
};
return StartServerResult.Started;
}
}
}