37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using MBN_STOCK_WEBVIEW.LegacyApplication;
|
|
|
|
namespace MBN_STOCK_WEBVIEW.LegacyBridge.Tests;
|
|
|
|
public sealed class LegacyTabActivationBridgeTests
|
|
{
|
|
[Theory]
|
|
[InlineData("theme", LegacyOperatorTabId.Theme)]
|
|
[InlineData("expert", LegacyOperatorTabId.Expert)]
|
|
public void SelectTab_CarriesOnlyClosedTabIdentity(
|
|
string tabId,
|
|
LegacyOperatorTabId expected)
|
|
{
|
|
Assert.True(LegacyBridgeProtocol.TryParseIntent(
|
|
$"{{\"type\":\"select-tab\",\"payload\":{{\"tabId\":\"{tabId}\"}}}}",
|
|
out var parsed,
|
|
out _));
|
|
|
|
Assert.Equal(expected, Assert.IsType<LegacySelectTabIntent>(parsed).TabId);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("theme", "query", "")]
|
|
[InlineData("theme", "nxtSession", "preMarket")]
|
|
[InlineData("expert", "query", "")]
|
|
public void SelectTab_RejectsWebSuppliedInitialLoadParameters(
|
|
string tabId,
|
|
string extraName,
|
|
string extraValue)
|
|
{
|
|
var json = "{\"type\":\"select-tab\",\"payload\":{" +
|
|
$"\"tabId\":\"{tabId}\",\"{extraName}\":\"{extraValue}\"}}}}";
|
|
|
|
Assert.False(LegacyBridgeProtocol.TryParseIntent(json, out _, out _));
|
|
}
|
|
}
|