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
65
tests/Paca.Tests/Core/PlaybackHistorySyncManagerGateTests.cs
Normal file
65
tests/Paca.Tests/Core/PlaybackHistorySyncManagerGateTests.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Paca.Mobile.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Core;
|
||||
|
||||
public class PlaybackHistorySyncManagerGateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Gate449_PlaybackHistorySyncManager_RecordsProgress_AndCompletion()
|
||||
{
|
||||
// 96% completion -> marks finished, reset resume position
|
||||
var itemDone = PlaybackHistorySyncManager.CreateRecord("v1", "movie.mp4", 960.0, 1000.0, DateTime.UtcNow);
|
||||
Assert.True(itemDone.IsFinished);
|
||||
Assert.Equal(0.0, itemDone.ResumePositionSec);
|
||||
Assert.Equal(96.0, itemDone.CompletionPercent, 1);
|
||||
|
||||
// 50% completion -> keeps resume position
|
||||
var itemMid = PlaybackHistorySyncManager.CreateRecord("v2", "show.mp4", 500.0, 1000.0, DateTime.UtcNow);
|
||||
Assert.False(itemMid.IsFinished);
|
||||
Assert.Equal(500.0, itemMid.ResumePositionSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate440_PlaybackHistorySyncManager_IgnoresNearZero_Resumes()
|
||||
{
|
||||
var item = PlaybackHistorySyncManager.CreateRecord("v3", "clip.mp4", 3.0, 100.0, DateTime.UtcNow);
|
||||
Assert.Equal(0.0, item.ResumePositionSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate451_PlaybackHistorySyncManager_MergesCrossDeviceRecords_ConflictResolution()
|
||||
{
|
||||
var dtDesktop = new DateTime(2026, 9, 4, 10, 0, 0, DateTimeKind.Utc);
|
||||
var dtMobile = new DateTime(2026, 9, 4, 11, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
var rDesktop = PlaybackHistorySyncManager.CreateRecord("v1", "doc.mp4", 300.0, 1000.0, dtDesktop);
|
||||
var rMobile = PlaybackHistorySyncManager.CreateRecord("v1", "doc.mp4", 600.0, 1000.0, dtMobile);
|
||||
|
||||
var merged = PlaybackHistorySyncManager.Merge(rDesktop, rMobile);
|
||||
|
||||
Assert.Equal(600.0, merged.ResumePositionSec);
|
||||
Assert.Equal(dtMobile, merged.LastPlayedAtUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate452_PlaybackHistorySyncManager_SerializesAndRestores_HistoryDatabase()
|
||||
{
|
||||
var list = new List<PlaybackHistoryRecord>
|
||||
{
|
||||
PlaybackHistorySyncManager.CreateRecord("v1", "a.mp4", 100.0, 500.0, DateTime.UtcNow),
|
||||
PlaybackHistorySyncManager.CreateRecord("v2", "b.mp4", 980.0, 1000.0, DateTime.UtcNow)
|
||||
};
|
||||
|
||||
var json = PlaybackHistorySyncManager.ToJson(list);
|
||||
var restored = PlaybackHistorySyncManager.FromJson(json);
|
||||
|
||||
Assert.NotNull(restored);
|
||||
Assert.Equal(2, restored.Count);
|
||||
Assert.Equal("v1", restored[0].MediaId);
|
||||
Assert.Equal("v2", restored[1].MediaId);
|
||||
Assert.True(restored[1].IsFinished);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue