64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
using Paca.Mobile.Core;
|
|
using Paca.Tests.Infrastructure;
|
|
using Xunit;
|
|
|
|
namespace Paca.Tests.App;
|
|
|
|
/// <summary>
|
|
/// Gate 161 ~ 163: 데스크톱 ↔ 모바일 원격 탭 동기화 및 원클릭 웹 브라우징 릴레이 기계적 검증
|
|
/// </summary>
|
|
public class DesktopRemoteTabSyncGateTests
|
|
{
|
|
[Fact]
|
|
public void Gate161_RemoteTabs_Models_And_Serialization()
|
|
{
|
|
var tab = new RemoteTabDto(
|
|
Id: "tab-101",
|
|
Title: "4K Nature Landscape - YouTube",
|
|
Url: "https://www.youtube.com/watch?v=12345",
|
|
IsActive: true
|
|
);
|
|
|
|
var json = JsonSerializer.Serialize(tab);
|
|
var deserialized = JsonSerializer.Deserialize<RemoteTabDto>(json);
|
|
|
|
Assert.NotNull(deserialized);
|
|
Assert.Equal("tab-101", deserialized.Id);
|
|
Assert.Equal("4K Nature Landscape - YouTube", deserialized.Title);
|
|
Assert.Equal("https://www.youtube.com/watch?v=12345", deserialized.Url);
|
|
Assert.True(deserialized.IsActive);
|
|
}
|
|
|
|
[Fact]
|
|
public void Gate162_ServerHost_Tabs_Endpoints_Registered()
|
|
{
|
|
var serverHostPath = Path.Combine(SourceTree.Root, "src", "Paca.Server", "ServerHost.cs");
|
|
Assert.True(File.Exists(serverHostPath), "ServerHost.cs must exist");
|
|
|
|
var code = File.ReadAllText(serverHostPath);
|
|
|
|
Assert.Contains("/api/tabs", code);
|
|
Assert.Contains("/api/tabs/open", code);
|
|
}
|
|
|
|
[Fact]
|
|
public void Gate163_ApiClient_RemoteTabs_Methods_Implemented()
|
|
{
|
|
var mobileDir = Directory.Exists(Path.Combine(SourceTree.Root, "src", "Paca.Mobile"))
|
|
? Path.Combine(SourceTree.Root, "src", "Paca.Mobile")
|
|
: Path.Combine(SourceTree.Root, "Paca.Mobile");
|
|
|
|
var apiClientPath = File.Exists(Path.Combine(mobileDir, "ApiClient.cs"))
|
|
? Path.Combine(mobileDir, "ApiClient.cs")
|
|
: Path.Combine(SourceTree.Root, "src", "Paca.Mobile.Core", "ApiClient.cs");
|
|
Assert.True(File.Exists(apiClientPath), "ApiClient.cs must exist");
|
|
|
|
var code = File.ReadAllText(apiClientPath);
|
|
|
|
Assert.Contains("GetRemoteTabsAsync", code);
|
|
Assert.Contains("OpenRemoteTabAsync", code);
|
|
}
|
|
}
|