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
97
tests/Paca.Tests/Core/QuietHoursNotificationGateTests.cs
Normal file
97
tests/Paca.Tests/Core/QuietHoursNotificationGateTests.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Paca.Mobile.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Core;
|
||||
|
||||
public class QuietHoursNotificationGateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Gate297_QuietHoursNotificationManager_AccuratelyDetectsOvernightRange()
|
||||
{
|
||||
var settings = new QuietHoursSettings
|
||||
{
|
||||
IsEnabled = true,
|
||||
StartHour = TimeSpan.FromHours(22), // 22:00 (10 PM)
|
||||
EndHour = TimeSpan.FromHours(7) // 07:00 (7 AM)
|
||||
};
|
||||
|
||||
var nightTime = new DateTime(2026, 9, 4, 23, 30, 0);
|
||||
var earlyMorning = new DateTime(2026, 9, 5, 4, 15, 0);
|
||||
var dayTime = new DateTime(2026, 9, 5, 14, 0, 0);
|
||||
|
||||
Assert.True(QuietHoursNotificationManager.IsInQuietHours(nightTime, settings));
|
||||
Assert.True(QuietHoursNotificationManager.IsInQuietHours(earlyMorning, settings));
|
||||
Assert.False(QuietHoursNotificationManager.IsInQuietHours(dayTime, settings));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate298_QuietHoursNotificationManager_MutesSoundAndVibration_DuringQuietHours()
|
||||
{
|
||||
var settings = new QuietHoursSettings
|
||||
{
|
||||
IsEnabled = true,
|
||||
StartHour = TimeSpan.FromHours(23),
|
||||
EndHour = TimeSpan.FromHours(6),
|
||||
MuteSoundAndVibration = true
|
||||
};
|
||||
|
||||
var manager = new QuietHoursNotificationManager(settings);
|
||||
var evt = new DownloadNotificationItem("video-1", "Nature 4K", IsSuccess: true, FileSizeMb: 350.0);
|
||||
|
||||
var action = manager.EvaluateNotification(evt, new DateTime(2026, 9, 5, 1, 0, 0));
|
||||
|
||||
Assert.False(action.PlaySound);
|
||||
Assert.False(action.Vibrate);
|
||||
Assert.True(action.IsSuppressed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate299_QuietHoursNotificationManager_BundlesOvernightDownloads_IntoPendingList()
|
||||
{
|
||||
var settings = new QuietHoursSettings
|
||||
{
|
||||
IsEnabled = true,
|
||||
StartHour = TimeSpan.FromHours(22),
|
||||
EndHour = TimeSpan.FromHours(7),
|
||||
BundleSummary = true
|
||||
};
|
||||
|
||||
var manager = new QuietHoursNotificationManager(settings);
|
||||
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("1", "Track 1", true, 50.0), new DateTime(2026, 9, 4, 23, 0, 0));
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("2", "Track 2", true, 60.0), new DateTime(2026, 9, 5, 0, 30, 0));
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("3", "Track 3", false, 0.0), new DateTime(2026, 9, 5, 2, 0, 0));
|
||||
|
||||
Assert.Equal(3, manager.PendingCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate300_QuietHoursNotificationManager_GeneratesMorningDigestBriefing_Correctly()
|
||||
{
|
||||
var settings = new QuietHoursSettings
|
||||
{
|
||||
IsEnabled = true,
|
||||
StartHour = TimeSpan.FromHours(22),
|
||||
EndHour = TimeSpan.FromHours(7),
|
||||
BundleSummary = true
|
||||
};
|
||||
|
||||
var manager = new QuietHoursNotificationManager(settings);
|
||||
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("1", "Video 1", true, 200.0), new DateTime(2026, 9, 4, 23, 0, 0));
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("2", "Video 2", true, 800.0), new DateTime(2026, 9, 5, 1, 0, 0));
|
||||
manager.EvaluateNotification(new DownloadNotificationItem("3", "Video 3", false, 0.0), new DateTime(2026, 9, 5, 3, 0, 0));
|
||||
|
||||
// In morning at 07:15, generate digest
|
||||
var digest = manager.FlushMorningDigest(new DateTime(2026, 9, 5, 7, 15, 0));
|
||||
|
||||
Assert.NotNull(digest);
|
||||
Assert.Equal(2, digest!.SuccessCount);
|
||||
Assert.Equal(1, digest.FailureCount);
|
||||
Assert.Equal(1000.0, digest.TotalSizeMb);
|
||||
Assert.Contains("밤사이 다운로드 2건 완료, 1건 실패", digest.SummaryMessage);
|
||||
Assert.Equal(0, manager.PendingCount); // Flushed
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue