RecordingHelperTests.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using Emby.Server.Implementations.LiveTv.EmbyTV;
  3. using MediaBrowser.Controller.LiveTv;
  4. using Xunit;
  5. namespace Jellyfin.Server.Implementations.Tests.LiveTv
  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. return data;
  83. }
  84. [Theory]
  85. [MemberData(nameof(GetRecordingName_Success_TestData))]
  86. public static void GetRecordingName_Success(string expected, TimerInfo timerInfo)
  87. {
  88. Assert.Equal(expected, RecordingHelper.GetRecordingName(timerInfo));
  89. }
  90. }
  91. }