Source access enforcement (the catalog): 10-source catalog + per-scene access matrix enforced by SceneAccessPolicy; Add-Source menu is one ItemsSource rebuilt per scene (Screen = Live-only, BG/Image/Text every scene), webcam row always present + greys out; Chatbox/Alerts/Socials are inert SourceType rows ready for their features; Text queued as a ship step (countdown + credits modes); Monetization notes socialBar free = YouTube + 1, unlimited with the paid key (79 tests passing)
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using ytLive.Models;
|
||||
using ytLive.Services;
|
||||
|
||||
namespace ytLive.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The per-scene source access matrix from the source catalog (TASKS.md).
|
||||
/// One integration test: each canonical scene allows exactly its matrix set,
|
||||
/// nothing more; non-canonical scenes allow nothing.
|
||||
/// </summary>
|
||||
public class SceneAccessPolicyTests
|
||||
{
|
||||
private static readonly SourceType[] All =
|
||||
{
|
||||
SourceType.DisplayCapture, SourceType.WindowCapture, SourceType.Background,
|
||||
SourceType.Image, SourceType.TextOverlay, SourceType.Chatbox,
|
||||
SourceType.Alerts, SourceType.Socials,
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void SceneAccessPolicy_Enforces_The_Full_Access_Matrix()
|
||||
{
|
||||
var allowed = new[]
|
||||
{
|
||||
(Scene: "Starting", Types: new[]
|
||||
{
|
||||
SourceType.Background, SourceType.Image, SourceType.TextOverlay,
|
||||
SourceType.Alerts, SourceType.Socials,
|
||||
}),
|
||||
(Scene: "Live", Types: All),
|
||||
(Scene: "BRB", Types: new[]
|
||||
{
|
||||
SourceType.Background, SourceType.Image, SourceType.TextOverlay,
|
||||
SourceType.Chatbox, SourceType.Alerts, SourceType.Socials,
|
||||
}),
|
||||
(Scene: "Chat", Types: new[]
|
||||
{
|
||||
SourceType.Background, SourceType.Image, SourceType.TextOverlay,
|
||||
SourceType.Chatbox, SourceType.Alerts, SourceType.Socials,
|
||||
}),
|
||||
(Scene: "Ending", Types: new[]
|
||||
{
|
||||
SourceType.Background, SourceType.Image, SourceType.TextOverlay,
|
||||
SourceType.Alerts, SourceType.Socials,
|
||||
}),
|
||||
};
|
||||
|
||||
foreach (var (scene, types) in allowed)
|
||||
{
|
||||
foreach (var type in types)
|
||||
Assert.True(
|
||||
SceneAccessPolicy.Allows(scene, type),
|
||||
$"{type} should be allowed in {scene}");
|
||||
|
||||
foreach (var type in All.Where(t => !types.Contains(t)))
|
||||
Assert.False(
|
||||
SceneAccessPolicy.Allows(scene, type),
|
||||
$"{type} should NOT be allowed in {scene}");
|
||||
}
|
||||
|
||||
Assert.False(SceneAccessPolicy.Allows(null, SourceType.Image));
|
||||
Assert.False(SceneAccessPolicy.Allows("My Scene", SourceType.Image));
|
||||
Assert.False(SceneAccessPolicy.Allows(" ", SourceType.TextOverlay));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user