Files
MBN_STOCK_WEBVIEW/tests/MBN_STOCK_WEBVIEW.Playout.Tests/PlayoutSceneCompositionFactoryTests.cs

54 lines
1.9 KiB
C#

using MBN_STOCK_WEBVIEW.Core.Playout.Scenes;
namespace MBN_STOCK_WEBVIEW.Playout.Tests;
public sealed class PlayoutSceneCompositionFactoryTests
{
[Fact]
public void Default_MatchesLegacyFadeAndRequiresNoExternalAsset()
{
var result = PlayoutSceneCompositionFactory.Create(new PlayoutOptions());
Assert.Equal(6, result.FadeDuration);
Assert.Equal(LegacySceneBackgroundKind.None, result.BackgroundKind);
Assert.Null(result.BackgroundAssetPath);
}
[Fact]
public void TrustedRelativeVideo_IsVerifiedEvenInDryRun()
{
using var scenes = TemporarySceneDirectory.Create("Video\\studio.vrv");
var result = PlayoutSceneCompositionFactory.Create(new PlayoutOptions
{
Mode = PlayoutMode.DryRun,
SceneDirectory = scenes.Path,
LegacySceneBackgroundKind = LegacySceneBackgroundKind.Video,
LegacySceneBackgroundAssetPath = "Video\\studio.vrv"
});
Assert.Equal(LegacySceneBackgroundKind.Video, result.BackgroundKind);
Assert.Equal(Path.Combine("Video", "studio.vrv"), result.BackgroundAssetPath);
Assert.Equal(2004, result.BackgroundVideoLoopCount);
}
[Theory]
[InlineData("Video:studio.vrv")]
[InlineData("..\\outside.vrv")]
[InlineData("Video\\missing.vrv")]
[InlineData("Video\\studio.exe")]
public void InvalidOrMissingBackground_FailsBeforeDryRunPrepare(string relativePath)
{
using var scenes = TemporarySceneDirectory.Create("Video\\studio.vrv");
var options = new PlayoutOptions
{
Mode = PlayoutMode.DryRun,
SceneDirectory = scenes.Path,
LegacySceneBackgroundKind = LegacySceneBackgroundKind.Video,
LegacySceneBackgroundAssetPath = relativePath
};
Assert.Throws<PlayoutConfigurationException>(() =>
PlayoutSceneCompositionFactory.Create(options));
}
}