test(app): add app test scaffolding and headless test harness
This commit is contained in:
1 parent
d679231fed
commit
1f1b78e50b
4 files changed
+105
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using Vantage.Core.Health;
|
||||
using Vantage.Core.Metrics;
|
||||
using Vantage.Core.Models;
|
||||
|
||||
namespace Vantage.App.Tests.Fakes;
|
||||
|
||||
public sealed class ThrowingMetricsProvider : IMetricsProvider
|
||||
{
|
||||
public const string Message = "host unreachable";
|
||||
|
||||
public Task<HostMetrics> GetMetricsAsync(HostConfig host, CancellationToken cancellationToken) =>
|
||||
throw new InvalidOperationException(Message);
|
||||
}
|
||||
|
||||
public sealed class FakeHealthChecker : IHealthChecker
|
||||
{
|
||||
private readonly HealthCheckResult result;
|
||||
|
||||
public FakeHealthChecker(HealthCheckResult result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int Calls { get; private set; }
|
||||
|
||||
public Task<HealthCheckResult> CheckAsync(HealthCheckConfig check, CancellationToken cancellationToken)
|
||||
{
|
||||
Calls++;
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user