Files
pgsql-jellyfin/tests/Jellyfin.Providers.Tests/MediaInfo/FFProbeVideoInfoTests.cs
wjones af1152b001 Refactor: standardize namespace and using directive style
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
2026-02-20 16:26:53 -05:00

66 lines
2.0 KiB
C#

// <copyright file="FFProbeVideoInfoTests.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace Jellyfin.Providers.Tests.MediaInfo;
using System;
using AutoFixture;
using AutoFixture.AutoMoq;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Providers.MediaInfo;
using Moq;
using Xunit;
public class FFProbeVideoInfoTests
{
private readonly FFProbeVideoInfo _fFProbeVideoInfo;
public FFProbeVideoInfoTests()
{
var serverConfiguration = new ServerConfiguration()
{
DummyChapterDuration = (int)TimeSpan.FromMinutes(5).TotalSeconds
};
var serverConfig = new Mock<IServerConfigurationManager>();
serverConfig.Setup(c => c.Configuration)
.Returns(serverConfiguration);
IFixture fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true });
fixture.Inject(serverConfig);
_fFProbeVideoInfo = fixture.Create<FFProbeVideoInfo>();
}
[Theory]
[InlineData(-1L)]
[InlineData(long.MinValue)]
[InlineData(long.MaxValue)]
public void CreateDummyChapters_InvalidRuntime_ThrowsArgumentException(long? runtime)
{
Assert.Throws<ArgumentException>(
() => _fFProbeVideoInfo.CreateDummyChapters(new Video()
{
RunTimeTicks = runtime
}));
}
[Theory]
[InlineData(null, 0)]
[InlineData(0L, 0)]
[InlineData(1L, 0)]
[InlineData(TimeSpan.TicksPerMinute * 5, 0)]
[InlineData((TimeSpan.TicksPerMinute * 5) + 1, 1)]
[InlineData(TimeSpan.TicksPerMinute * 50, 10)]
public void CreateDummyChapters_ValidRuntime_CorrectChaptersCount(long? runtime, int chaptersCount)
{
var chapters = _fFProbeVideoInfo.CreateDummyChapters(new Video()
{
RunTimeTicks = runtime
});
Assert.Equal(chaptersCount, chapters.Length);
}
}