59 lines
2.3 KiB
C#
59 lines
2.3 KiB
C#
using System.Text.Json;
|
|
using MBN_STOCK_WEBVIEW.LegacyApplication;
|
|
|
|
namespace MBN_STOCK_WEBVIEW.LegacyBridge.Tests;
|
|
|
|
public sealed class LegacyFixedSectionBatchBridgeTests
|
|
{
|
|
[Fact]
|
|
public void Existing_fixed_section_intent_stays_strict_and_cannot_supply_resume_authority()
|
|
{
|
|
Assert.True(LegacyBridgeProtocol.TryParseIntent(
|
|
"{\"type\":\"activate-fixed-section\",\"payload\":{\"sectionIndex\":6}}",
|
|
out var parsed,
|
|
out var error), error);
|
|
Assert.Equal(6, Assert.IsType<LegacyActivateFixedSectionIntent>(parsed).SectionIndex);
|
|
|
|
Assert.False(LegacyBridgeProtocol.TryParseIntent(
|
|
"{\"type\":\"activate-fixed-section\",\"payload\":{\"sectionIndex\":6,\"resume\":true}}",
|
|
out _,
|
|
out _));
|
|
}
|
|
|
|
[Fact]
|
|
public void State_projects_only_native_fixed_section_progress_and_no_staged_rows()
|
|
{
|
|
var snapshot = new LegacyOperatorSnapshot(
|
|
1,
|
|
string.Empty,
|
|
Array.Empty<LegacyStockResultRow>(),
|
|
null,
|
|
Array.Empty<LegacyCutViewRow>(),
|
|
Array.Empty<LegacyOperatorPlaylistRow>(),
|
|
null,
|
|
"매매동향 섹션 수동 입력 1/3",
|
|
LegacyOperatorStatusKind.Information,
|
|
FixedSectionBatch: new LegacyFixedSectionBatchView(
|
|
6,
|
|
"매매동향",
|
|
15,
|
|
12,
|
|
1,
|
|
3,
|
|
"fixed-245",
|
|
"개인 순매도 상위(수동)"));
|
|
|
|
using var document = JsonDocument.Parse(LegacyBridgeProtocol.SerializeState(snapshot));
|
|
var root = document.RootElement.GetProperty("payload");
|
|
var batch = root.GetProperty("fixedSectionBatch");
|
|
|
|
Assert.Equal(6, batch.GetProperty("sectionIndex").GetInt32());
|
|
Assert.Equal(15, batch.GetProperty("totalActionCount").GetInt32());
|
|
Assert.Equal(12, batch.GetProperty("stagedActionCount").GetInt32());
|
|
Assert.Equal("fixed-245", batch.GetProperty("pendingActionId").GetString());
|
|
Assert.Empty(root.GetProperty("playlist").EnumerateArray());
|
|
Assert.DoesNotContain("selection", batch.GetRawText(), StringComparison.OrdinalIgnoreCase);
|
|
Assert.DoesNotContain("sceneAlias", batch.GetRawText(), StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
}
|