RecordingHelperTests.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.Generic;
  3. using Emby.Server.Implementations.LiveTv.EmbyTV;
  4. using MediaBrowser.Controller.LiveTv;
  5. using Xunit;
  6. namespace Jellyfin.Server.Implementations.Tests.LiveTv
  7. {
  8. public static class RecordingHelperTests
  9. {
  10. public static TheoryData<string, TimerInfo> GetRecordingName_Success_TestData()
  11. {
  12. var data = new TheoryData<string, TimerInfo>();
  13. data.Add(
  14. "The Incredibles 2020_04_20_21_06_00",
  15. new TimerInfo
  16. {
  17. Name = "The Incredibles",
  18. StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
  19. IsMovie = true
  20. });
  21. data.Add(
  22. "The Incredibles (2004)",
  23. new TimerInfo
  24. {
  25. Name = "The Incredibles",
  26. IsMovie = true,
  27. ProductionYear = 2004
  28. });
  29. data.Add(
  30. "The Big Bang Theory 2020_04_20_21_06_00",
  31. new TimerInfo
  32. {
  33. Name = "The Big Bang Theory",
  34. StartDate = new DateTime(2020, 4, 20, 21, 6, 0, DateTimeKind.Local),
  35. IsProgramSeries = true,
  36. });
  37. data.Add(
  38. "The Big Bang Theory S12E10",
  39. new TimerInfo
  40. {
  41. Name = "The Big Bang Theory",
  42. IsProgramSeries = true,
  43. SeasonNumber = 12,
  44. EpisodeNumber = 10
  45. });
  46. data.Add(
  47. "The Big Bang Theory S12E10 The VCR Illumination",
  48. new TimerInfo
  49. {
  50. Name = "The Big Bang Theory",
  51. IsProgramSeries = true,
  52. SeasonNumber = 12,
  53. EpisodeNumber = 10,
  54. EpisodeTitle = "The VCR Illumination"
  55. });
  56. data.Add(
  57. "The Big Bang Theory 2018-12-06",
  58. new TimerInfo
  59. {
  60. Name = "The Big Bang Theory",
  61. IsProgramSeries = true,
  62. OriginalAirDate = new DateTime(2018, 12, 6)
  63. });
  64. data.Add(
  65. "The Big Bang Theory 2018-12-06 - The VCR Illumination",
  66. new TimerInfo
  67. {
  68. Name = "The Big Bang Theory",
  69. IsProgramSeries = true,
  70. OriginalAirDate = new DateTime(2018, 12, 6),
  71. EpisodeTitle = "The VCR Illumination"
  72. });
  73. data.Add(
  74. "The Big Bang Theory 2018_12_06_21_06_00 - The VCR Illumination",
  75. new TimerInfo
  76. {
  77. Name = "The Big Bang Theory",
  78. StartDate = new DateTime(2018, 12, 6, 21, 6, 0, DateTimeKind.Local),
  79. IsProgramSeries = true,
  80. OriginalAirDate = new DateTime(2018, 12, 6),
  81. EpisodeTitle = "The VCR Illumination"
  82. });
  83. return data;
  84. }
  85. [Theory]
  86. [MemberData(nameof(GetRecordingName_Success_TestData))]
  87. public static void GetRecordingName_Success(string expected, TimerInfo timerInfo)
  88. {
  89. Assert.Equal(expected, RecordingHelper.GetRecordingName(timerInfo));
  90. }
  91. }
  92. }