39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.IO;
|
|
using Paca.Mobile.Core;
|
|
using Paca.Tests.Infrastructure;
|
|
using Xunit;
|
|
|
|
namespace Paca.Tests.Mobile;
|
|
|
|
public class MobileDeepLinkTargetGateTests
|
|
{
|
|
[Fact]
|
|
public void Gate221_MobileDeepLinkTarget_DeliversAndConsumes_Action()
|
|
{
|
|
// 1. Consume empty
|
|
_ = MobileDeepLinkTarget.Consume();
|
|
|
|
// 2. Deliver valid paca URI
|
|
MobileDeepLinkTarget.Deliver("paca://download?url=https%3A%2F%2Ftest.com%2Fvideo.mp4");
|
|
|
|
// 3. Consume returns action
|
|
var action = MobileDeepLinkTarget.Consume();
|
|
Assert.NotNull(action);
|
|
var dl = Assert.IsType<PacaDownloadDeepLinkAction>(action);
|
|
Assert.Equal("https://test.com/video.mp4", dl.TargetUrl);
|
|
|
|
// 4. Second consume is null
|
|
Assert.Null(MobileDeepLinkTarget.Consume());
|
|
}
|
|
|
|
[Fact]
|
|
public void Gate222_MobileMainActivity_HasPacaSchemeIntentFilter()
|
|
{
|
|
var mainActivityPath = Path.Combine(SourceTree.Root, "src", "Paca.Mobile", "Platforms", "Android", "MainActivity.cs");
|
|
Assert.True(File.Exists(mainActivityPath), "MainActivity.cs must exist");
|
|
|
|
var code = File.ReadAllText(mainActivityPath);
|
|
Assert.Contains(@"DataScheme = ""paca""", code);
|
|
Assert.Contains(@"Intent.ActionView", code);
|
|
}
|
|
}
|