feat: complete legacy UI and playout parity migration
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using MMoneyCoderSharp.Data;
|
||||
|
||||
namespace MBN_STOCK_WEBVIEW.LegacyApplication.Tests;
|
||||
|
||||
public sealed class LegacyOperatorPlayoutRequestTests
|
||||
{
|
||||
[Fact]
|
||||
public void EmptyPlaylistCannotCreatePlayoutRequest()
|
||||
{
|
||||
var controller = new LegacyOperatorController(new StaticLookup());
|
||||
|
||||
Assert.Throws<InvalidOperationException>(controller.CreatePlayoutRequest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RequestPreservesNativePlaylistIdentityEnabledStateAndSelection()
|
||||
{
|
||||
var controller = new LegacyOperatorController(new StaticLookup());
|
||||
await controller.SearchStocksAsync("삼성", LegacySearchTrigger.Button);
|
||||
controller.SelectStock(0);
|
||||
AddCut(controller, physicalIndex: 0, timestamp: 1_000);
|
||||
AddCut(controller, physicalIndex: 1, timestamp: 2_000);
|
||||
var rows = controller.Current.Playlist;
|
||||
controller.SetPlaylistRowEnabled(rows[0].RowId, enabled: false);
|
||||
controller.SelectPlaylistRow(rows[1].RowId, control: false, shift: false);
|
||||
|
||||
var request = controller.CreatePlayoutRequest();
|
||||
|
||||
Assert.Equal(1, request.SelectedIndexZeroBased);
|
||||
Assert.Equal(2, request.Playlist.Count);
|
||||
Assert.Equal(rows.Select(row => row.RowId),
|
||||
request.Playlist.Select(entry => entry.EntryId));
|
||||
Assert.False(request.Playlist[0].IsEnabled);
|
||||
Assert.True(request.Playlist[1].IsEnabled);
|
||||
Assert.All(request.Playlist, entry =>
|
||||
Assert.Equal("005930", entry.Selection?.DataCode));
|
||||
}
|
||||
|
||||
private static void AddCut(
|
||||
LegacyOperatorController controller,
|
||||
int physicalIndex,
|
||||
long timestamp)
|
||||
{
|
||||
controller.CutPointerDown(
|
||||
physicalIndex,
|
||||
control: false,
|
||||
shift: false,
|
||||
x: 1,
|
||||
y: physicalIndex * 23,
|
||||
timestampMilliseconds: timestamp);
|
||||
controller.DropSelectedCutsOnPlaylist();
|
||||
}
|
||||
|
||||
private sealed class StaticLookup : ILegacyStockLookup
|
||||
{
|
||||
public Task<LegacyStockSearchData> SearchAsync(
|
||||
string query,
|
||||
CancellationToken cancellationToken = default) =>
|
||||
Task.FromResult(new LegacyStockSearchData(
|
||||
query,
|
||||
["삼성전자"],
|
||||
[new LegacyStockIdentity(
|
||||
LegacyDomesticStockMarket.Kospi,
|
||||
"삼성전자",
|
||||
"005930")]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user