From e6ec08052dc3811aaeec90a4dcd0e15e14408c0d Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Mon, 1 Apr 2019 14:51:55 +0100 Subject: [PATCH] more --- .../Engine/CalendarEngineTests.cs | 45 ++++++++++++++++++- src/Ombi.Core/Engine/V2/CalendarEngine.cs | 2 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Core.Tests/Engine/CalendarEngineTests.cs b/src/Ombi.Core.Tests/Engine/CalendarEngineTests.cs index f660dff75..190c6c758 100644 --- a/src/Ombi.Core.Tests/Engine/CalendarEngineTests.cs +++ b/src/Ombi.Core.Tests/Engine/CalendarEngineTests.cs @@ -101,8 +101,40 @@ namespace Ombi.Core.Tests.Engine Assert.That(data[0].Title, Is.EqualTo("Valid")); } + + [TestCaseSource(nameof(StatusTvColorData))] + public async Task Calendar_Tv_StatusColor(AvailabilityTestModel model) + { + var tv = new List + { + new ChildRequests + { + SeasonRequests = new List + { + new SeasonRequests + { + Episodes = new List + { + new EpisodeRequests + { + Title = "Valid", + AirDate = DateTime.Now, + Approved = model.Approved, + Available = model.Available + }, + } + } + } + }, + }; + TvRepo.Setup(x => x.GetChild()).Returns(tv.AsQueryable()); + var data = await CalendarEngine.GetCalendarData(); + + return data[0].BackgroundColor; + } + [TestCaseSource(nameof(StatusColorData))] - public async Task Calendar_StatusColor(AvailabilityTestModel model) + public async Task Calendar_Movie_StatusColor(AvailabilityTestModel model) { var movies = new List { @@ -130,6 +162,17 @@ namespace Ombi.Core.Tests.Engine Approved = true, Denied = true }).Returns("red").SetName("Calendar_DeniedRequest"); + foreach (var testCaseData in StatusTvColorData) + { + yield return testCaseData; + } + } + } + + public static IEnumerable StatusTvColorData + { + get + { yield return new TestCaseData(new AvailabilityTestModel { Available = true, diff --git a/src/Ombi.Core/Engine/V2/CalendarEngine.cs b/src/Ombi.Core/Engine/V2/CalendarEngine.cs index b160abcaf..f4b63beb2 100644 --- a/src/Ombi.Core/Engine/V2/CalendarEngine.cs +++ b/src/Ombi.Core/Engine/V2/CalendarEngine.cs @@ -69,7 +69,7 @@ namespace Ombi.Core.Engine.V2 return viewModel; } - private string GetBackgroundColor(MovieRequests req) + private string GetBackgroundColor(BaseRequest req) { if (req.Available) {