af1152b001
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.
40 lines
2.0 KiB
C#
40 lines
2.0 KiB
C#
// <copyright file="OrderMapperTests.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Server.Implementations.Tests.Item;
|
|
|
|
using System;
|
|
using Jellyfin.Data.Enums;
|
|
using Jellyfin.Database.Implementations.Entities;
|
|
using Jellyfin.Server.Implementations.Item;
|
|
using MediaBrowser.Controller.Entities;
|
|
using Xunit;
|
|
|
|
public class OrderMapperTests
|
|
{
|
|
[Fact]
|
|
public void ShouldReturnMappedOrderForSortingByPremierDate()
|
|
{
|
|
var orderFunc = OrderMapper.MapOrderByField(ItemSortBy.PremiereDate, new InternalItemsQuery(), null!).Compile();
|
|
|
|
var expectedDate = new DateTime(1, 2, 3);
|
|
var expectedProductionYearDate = new DateTime(4, 1, 1);
|
|
|
|
var entityWithOnlyProductionYear = new BaseItemEntity { Id = Guid.NewGuid(), Type = "Test", ProductionYear = expectedProductionYearDate.Year };
|
|
var entityWithOnlyPremierDate = new BaseItemEntity { Id = Guid.NewGuid(), Type = "Test", PremiereDate = expectedDate };
|
|
var entityWithBothPremierDateAndProductionYear = new BaseItemEntity { Id = Guid.NewGuid(), Type = "Test", PremiereDate = expectedDate, ProductionYear = expectedProductionYearDate.Year };
|
|
var entityWithoutEitherPremierDateOrProductionYear = new BaseItemEntity { Id = Guid.NewGuid(), Type = "Test" };
|
|
|
|
var resultWithOnlyProductionYear = orderFunc(entityWithOnlyProductionYear);
|
|
var resultWithOnlyPremierDate = orderFunc(entityWithOnlyPremierDate);
|
|
var resultWithBothPremierDateAndProductionYear = orderFunc(entityWithBothPremierDateAndProductionYear);
|
|
var resultWithoutEitherPremierDateOrProductionYear = orderFunc(entityWithoutEitherPremierDateOrProductionYear);
|
|
|
|
Assert.Equal(resultWithOnlyProductionYear, expectedProductionYearDate);
|
|
Assert.Equal(resultWithOnlyPremierDate, expectedDate);
|
|
Assert.Equal(resultWithBothPremierDateAndProductionYear, expectedDate);
|
|
Assert.Null(resultWithoutEitherPremierDateOrProductionYear);
|
|
}
|
|
}
|