Files
KArtSell.Aegis/tests/KArtSell.Integration.Tests/TradeExecution/KisTradingHardOffTests.cs
T
kjh2064 eb59cae8e3 security: hard-disable all KIS trading paths (AEG-X-016)
Blocks submit, status, cancel, and settlement before HTTP or database writes and removes the KIS polling recurring job. Evidence: concrete adapter test 1/1 passed with zero HTTP calls. WBS remains IN_PROGRESS pending endpoint/startup override evidence.
2026-08-09 02:30:39 +09:00

36 lines
1.4 KiB
C#

using System.Net;
using KArtSell.Modules.ModelOperations.TradeExecution;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
namespace KArtSell.Integration.Tests.TradeExecution;
public sealed class KisTradingHardOffTests
{
[Fact]
public async Task Every_kis_trade_operation_fails_before_any_http_call()
{
var handler = new CountingHandler();
var service = new KisTradeExecutionService(new HttpClient(handler), NullLogger<KisTradeExecutionService>.Instance);
var correlationId = Guid.NewGuid();
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.ExecuteTradeAsync(Guid.NewGuid(), 1, 1m, correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.GetOrderStatusAsync("order", correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.CancelOrderAsync("order", "test", correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.ConfirmSettlementAsync("order", correlationId));
Assert.Equal(0, handler.CallCount);
}
private sealed class CountingHandler : HttpMessageHandler
{
public int CallCount { get; private set; }
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
CallCount++;
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
}
}
}