aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests/LiveTv/RecordingHelperTests.cs
blob: 09aec82b0786995b3614a4ace3bc6c96da4bfa0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using Emby.Server.Implementations.LiveTv.EmbyTV;
using MediaBrowser.Controller.LiveTv;
using Xunit;

namespace Jellyfin.Server.Implementations.Tests.LiveTv
{
    public static class RecordingHelperTests
    {
        public static TheoryData<string, TimerInfo> GetRecordingName_Success_TestData()
        {
            var data = new TheoryData<string, TimerInfo>();

            data.Add(
                "The Incredibles 2020_04_20_21_06_00",
                new TimerInfo
                {
                    Name = "The Incredibles",
                    StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
                    IsMovie = true
                });

            data.Add(
                "The Incredibles (2004)",
                new TimerInfo
                {
                    Name = "The Incredibles",
                    IsMovie = true,
                    ProductionYear = 2004
                });
            data.Add(
                "The Big Bang Theory 2020_04_20_21_06_00",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
                    IsProgramSeries = true,
                });
            data.Add(
                "The Big Bang Theory S12E10",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    IsProgramSeries = true,
                    SeasonNumber = 12,
                    EpisodeNumber = 10
                });
            data.Add(
                "The Big Bang Theory S12E10 The VCR Illumination",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    IsProgramSeries = true,
                    SeasonNumber = 12,
                    EpisodeNumber = 10,
                    EpisodeTitle = "The VCR Illumination"
                });
            data.Add(
                "The Big Bang Theory 2018-12-06",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    IsProgramSeries = true,
                    OriginalAirDate = new DateTime(2018, 12, 6, 0, 0, 0, DateTimeKind.Local)
                });

            data.Add(
                "The Big Bang Theory 2018-12-06 - The VCR Illumination",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    IsProgramSeries = true,
                    OriginalAirDate = new DateTime(2018, 12, 6, 0, 0, 0, DateTimeKind.Local),
                    EpisodeTitle = "The VCR Illumination"
                });

            data.Add(
                "The Big Bang Theory 2018_12_06_21_06_00 - The VCR Illumination",
                new TimerInfo
                {
                    Name = "The Big Bang Theory",
                    StartDate = new DateTime(2018, 12, 6, 21, 6, 0, DateTimeKind.Local),
                    IsProgramSeries = true,
                    OriginalAirDate = new DateTime(2018, 12, 6),
                    EpisodeTitle = "The VCR Illumination"
                });

            return data;
        }

        [Theory]
        [MemberData(nameof(GetRecordingName_Success_TestData))]
        public static void GetRecordingName_Success(string expected, TimerInfo timerInfo)
        {
            Assert.Equal(expected, RecordingHelper.GetRecordingName(timerInfo));
        }
    }
}