refactor(dotnet): add collection audit trail
This commit is contained in:
@@ -93,6 +93,11 @@ public class KisDataCollectionOrchestratorTests
|
||||
var runId = "test-run-002";
|
||||
var ticker = "005930";
|
||||
var account = "mock";
|
||||
var auditPath = Path.Combine(FindRepoRoot(), "Temp", "collection_audit", $"{runId}.jsonl");
|
||||
if (File.Exists(auditPath))
|
||||
{
|
||||
File.Delete(auditPath);
|
||||
}
|
||||
|
||||
_repositoryMock
|
||||
.Setup(r => r.GetLatestSnapshotsForTickerAsync(ticker, It.IsAny<int>()))
|
||||
@@ -128,6 +133,8 @@ public class KisDataCollectionOrchestratorTests
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("COMPLETED", result.Status);
|
||||
Assert.Equal(1, result.SuccessCount);
|
||||
Assert.True(File.Exists(auditPath));
|
||||
Assert.Contains("COMPLETED", File.ReadAllText(auditPath));
|
||||
|
||||
_kisApiClientMock.Verify(
|
||||
k => k.GetCurrentPriceAsync(ticker, account),
|
||||
@@ -390,4 +397,19 @@ public class KisDataCollectionOrchestratorTests
|
||||
Assert.False(result);
|
||||
Assert.Null(args[2]);
|
||||
}
|
||||
|
||||
private static string FindRepoRoot()
|
||||
{
|
||||
var current = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (current != null)
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(current.FullName, ".git")))
|
||||
{
|
||||
return current.FullName;
|
||||
}
|
||||
current = current.Parent;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("Repository root not found.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user