mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 19:40:05 -07:00
started adding some more unit tests #1596
This commit is contained in:
parent
727c7be9f2
commit
b7b0381ce7
12 changed files with 419 additions and 14 deletions
|
@ -5,24 +5,25 @@ using Ombi.Core.Models.Search;
|
|||
using Ombi.Core.Rule.Interfaces;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
|
||||
namespace Ombi.Core.Rule.Rules.Search
|
||||
{
|
||||
public class CouchPotatoCacheRule : BaseSearchRule, IRules<SearchViewModel>
|
||||
{
|
||||
public CouchPotatoCacheRule(IOmbiContext ctx)
|
||||
public CouchPotatoCacheRule(IRepository<CouchPotatoCache> ctx)
|
||||
{
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
private readonly IOmbiContext _ctx;
|
||||
private readonly IRepository<CouchPotatoCache> _ctx;
|
||||
|
||||
public async Task<RuleResult> Execute(SearchViewModel obj)
|
||||
{
|
||||
if (obj.Type == RequestType.Movie)
|
||||
{
|
||||
// Check if it's in Radarr
|
||||
var result = await _ctx.CouchPotatoCache.FirstOrDefaultAsync(x => x.TheMovieDbId == obj.Id);
|
||||
var result = await _ctx.FirstOrDefaultAsync(x => x.TheMovieDbId == obj.Id);
|
||||
if (result != null)
|
||||
{
|
||||
obj.Approved =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue