RecordingHelperTests.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using Jellyfin.LiveTv.Recordings;
  3. using MediaBrowser.Controller.LiveTv;
  4. using Xunit;
  5. namespace Jellyfin.LiveTv.Tests
  6. {
  7. public static class RecordingHelperTests
  8. {
  9. public static TheoryData<string, TimerInfo> GetRecordingName_Success_TestData()
  10. {
  11. var data = new TheoryData<string, TimerInfo>();
  12. data.Add(
  13. "The Incredibles 2020_04_20_21_06_00",
  14. new TimerInfo
  15. {
  16. Name = "The Incredibles",
  17. StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
  18. IsMovie = true
  19. });
  20. data.Add(
  21. "The Incredibles (2004)",
  22. new TimerInfo
  23. {
  24. Name = "The Incredibles",
  25. IsMovie = true,
  26. ProductionYear = 2004
  27. });
  28. data.Add(
  29. "The Big Bang Theory 2020_04_20_21_06_00",
  30. new TimerInfo
  31. {
  32. Name = "The Big Bang Theory",
  33. StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
  34. IsProgramSeries = true,
  35. });
  36. data.Add(
  37. "The Big Bang Theory S12E10",
  38. new TimerInfo
  39. {
  40. Name = "The Big Bang Theory",
  41. IsProgramSeries = true,
  42. SeasonNumber = 12,
  43. EpisodeNumber = 10
  44. });
  45. data.Add(
  46. "The Big Bang Theory S12E10 The VCR Illumination",
  47. new TimerInfo
  48. {
  49. Name = "The Big Bang Theory",
  50. IsProgramSeries = true,
  51. SeasonNumber = 12,
  52. EpisodeNumber = 10,
  53. EpisodeTitle = "The VCR Illumination"
  54. });
  55. data.Add(
  56. "The Big Bang Theory 2018-12-06",
  57. new TimerInfo
  58. {
  59. Name = "The Big Bang Theory",
  60. IsProgramSeries = true,
  61. OriginalAirDate = new DateTime(2018, 12, 6, 0, 0, 0, DateTimeKind.Local)
  62. });
  63. data.Add(
  64. "The Big Bang Theory 2018-12-06 - The VCR Illumination",
  65. new TimerInfo
  66. {
  67. Name = "The Big Bang Theory",
  68. IsProgramSeries = true,
  69. OriginalAirDate = new DateTime(2018, 12, 6, 0, 0, 0, DateTimeKind.Local),
  70. EpisodeTitle = "The VCR Illumination"
  71. });
  72. data.Add(
  73. "The Big Bang Theory 2018_12_06_21_06_00 - The VCR Illumination",
  74. new TimerInfo
  75. {
  76. Name = "The Big Bang Theory",
  77. StartDate = new DateTime(2018, 12, 6, 21, 6, 0, DateTimeKind.Local),
  78. IsProgramSeries = true,
  79. OriginalAirDate = new DateTime(2018, 12, 6),
  80. EpisodeTitle = "The VCR Illumination"
  81. });
  82. data.Add(
  83. "Lorem ipsum dolor sit amet: consect 2018_12_06_21_06_00",
  84. new TimerInfo
  85. {
  86. Name = "Lorem ipsum dolor sit amet: consect",
  87. IsProgramSeries = true,
  88. StartDate = new DateTime(2018, 12, 6, 21, 6, 0, DateTimeKind.Local),
  89. OriginalAirDate = new DateTime(2018, 12, 6),
  90. EpisodeTitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor"
  91. });
  92. return data;
  93. }
  94. [Theory]
  95. [MemberData(nameof(GetRecordingName_Success_TestData))]
  96. public static void GetRecordingName_Success(string expected, TimerInfo timerInfo)
  97. {
  98. Assert.Equal(expected, RecordingHelper.GetRecordingName(timerInfo));
  99. }
  100. }
  101. }