From 9c67607f95ffc359c70513b037ed9051d9b8d726 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 22 Jun 2020 22:04:46 +0100 Subject: [PATCH] Fixed unit tests --- src/Ombi.Schedule.Tests/IssuesPurgeTests.cs | 8 +++++--- src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Ombi.Schedule.Tests/IssuesPurgeTests.cs b/src/Ombi.Schedule.Tests/IssuesPurgeTests.cs index 068b00b13..712fdabee 100644 --- a/src/Ombi.Schedule.Tests/IssuesPurgeTests.cs +++ b/src/Ombi.Schedule.Tests/IssuesPurgeTests.cs @@ -9,6 +9,8 @@ using Ombi.Settings.Settings.Models; using Ombi.Store.Entities.Requests; using Ombi.Store.Repository; using System.Threading.Tasks; +using MockQueryable; +using MockQueryable.Moq; namespace Ombi.Schedule.Tests { @@ -49,7 +51,7 @@ namespace Ombi.Schedule.Tests }; Settings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new IssueSettings { DeleteIssues = true, DaysAfterResolvedToDelete = 5 }); - Repo.Setup(x => x.GetAll()).Returns(new EnumerableQuery(issues)); + Repo.Setup(x => x.GetAll()).Returns(new List(issues).AsQueryable().BuildMock().Object); await Job.Execute(null); Assert.That(issues.First().Status, Is.EqualTo(IssueStatus.Deleted)); @@ -74,7 +76,7 @@ namespace Ombi.Schedule.Tests }; Settings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new IssueSettings { DeleteIssues = true, DaysAfterResolvedToDelete = 5 }); - Repo.Setup(x => x.GetAll()).Returns(new EnumerableQuery(issues)); + Repo.Setup(x => x.GetAll()).Returns(new EnumerableQuery(issues).AsQueryable().BuildMock().Object); await Job.Execute(null); Assert.That(issues[0].Status, Is.Not.EqualTo(IssueStatus.Deleted)); @@ -100,7 +102,7 @@ namespace Ombi.Schedule.Tests }; Settings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new IssueSettings { DeleteIssues = true, DaysAfterResolvedToDelete = 5 }); - Repo.Setup(x => x.GetAll()).Returns(new EnumerableQuery(issues)); + Repo.Setup(x => x.GetAll()).Returns(new EnumerableQuery(issues).AsQueryable().BuildMock().Object); await Job.Execute(null); Assert.That(issues[0].Status, Is.Not.EqualTo(IssueStatus.Deleted)); diff --git a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj index 2964f71b9..5c6cae7d0 100644 --- a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj +++ b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj @@ -6,7 +6,7 @@ - +