20 lines
798 B
C#
20 lines
798 B
C#
using Grpc.Core;
|
|
using Mishima.Nexus.Wire.V1;
|
|
|
|
namespace Robotico.Nexus.Client.Tests.TestSupport;
|
|
|
|
/// <summary>In-memory fake standing in for <c>NexusHealthService</c>.</summary>
|
|
public sealed class FakeHealthService : NexusHealthService.NexusHealthServiceBase
|
|
{
|
|
/// <summary>When <see langword="false"/>, <see cref="Check"/> reports the server as not ready.</summary>
|
|
public bool Ready { get; set; } = true;
|
|
|
|
/// <inheritdoc />
|
|
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context)
|
|
{
|
|
HealthCheckResponse response = new() { Ready = Ready };
|
|
response.Planes.Add(new EnginePlaneHealth { Plane = "graph", Ready = Ready, Detail = Ready ? "ok" : "simulated down" });
|
|
return Task.FromResult(response);
|
|
}
|
|
}
|