feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization
This commit is contained in:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
57
tests/Paca.Tests/Mobile/P2pQrPayloadCodecTests.cs
Normal file
57
tests/Paca.Tests/Mobile/P2pQrPayloadCodecTests.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using Paca.Mobile.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Mobile;
|
||||
|
||||
public class P2pQrPayloadCodecTests
|
||||
{
|
||||
[Fact]
|
||||
public void Encode_And_Decode_Roundtrip_Succeeds()
|
||||
{
|
||||
var original = new P2pQrPayload
|
||||
{
|
||||
Host = "192.168.1.100",
|
||||
Port = 5000,
|
||||
Token = "secret-token-abcdef123456",
|
||||
DeviceName = "Encep Desktop PC",
|
||||
Fingerprint = "fp_9876543210"
|
||||
};
|
||||
|
||||
string encoded = P2pQrPayloadCodec.Encode(original);
|
||||
Assert.StartsWith("paca://pair?", encoded);
|
||||
|
||||
var decoded = P2pQrPayloadCodec.Decode(encoded);
|
||||
Assert.NotNull(decoded);
|
||||
Assert.Equal(original.Host, decoded.Host);
|
||||
Assert.Equal(original.Port, decoded.Port);
|
||||
Assert.Equal(original.Token, decoded.Token);
|
||||
Assert.Equal(original.DeviceName, decoded.DeviceName);
|
||||
Assert.Equal(original.Fingerprint, decoded.Fingerprint);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Decode_Invalid_Checksum_Throws()
|
||||
{
|
||||
var original = new P2pQrPayload
|
||||
{
|
||||
Host = "192.168.1.100",
|
||||
Port = 5000,
|
||||
Token = "secret-token",
|
||||
DeviceName = "PC",
|
||||
Fingerprint = "fp"
|
||||
};
|
||||
|
||||
string encoded = P2pQrPayloadCodec.Encode(original);
|
||||
// 체크섬 위조
|
||||
string tampered = encoded.Replace("sig=", "sig=tampered");
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => P2pQrPayloadCodec.Decode(tampered));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Decode_NonPacaScheme_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => P2pQrPayloadCodec.Decode("https://google.com"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue