|
|
@ -1,4 +1,5 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using FluentAssertions;
|
|
|
@ -216,6 +217,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
var result = db.Fetch<NewznabDefinition>();
|
|
|
|
var result = db.Fetch<NewznabDefinition>();
|
|
|
|
result.Should().HaveCount(5);
|
|
|
|
result.Should().HaveCount(5);
|
|
|
|
|
|
|
|
result.Should().OnlyContain(i => i.BuiltIn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
@ -236,16 +238,39 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
Mocker.SetConstant(db);
|
|
|
|
Mocker.SetConstant(db);
|
|
|
|
|
|
|
|
|
|
|
|
db.Insert(definitions[0]);
|
|
|
|
db.Insert(definitions[0]);
|
|
|
|
db.Insert(definitions[1]);
|
|
|
|
db.Insert(definitions[2]);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(definitions);
|
|
|
|
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(definitions);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
var result = db.Fetch<NewznabDefinition>();
|
|
|
|
var result = db.Fetch<NewznabDefinition>();
|
|
|
|
result.Should().HaveCount(5);
|
|
|
|
result.Should().HaveCount(2);
|
|
|
|
result.Where(d => d.Url == "http://www.nzbdrone.com").Should().HaveCount(3);
|
|
|
|
result.Where(d => d.Url == "http://www.nzbdrone.com").Should().HaveCount(1);
|
|
|
|
result.Where(d => d.Url == "http://www.nzbdrone2.com").Should().HaveCount(2);
|
|
|
|
result.Where(d => d.Url == "http://www.nzbdrone2.com").Should().HaveCount(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void InitializeNewznabIndexers_should_update_matching_indexer_to_be_builtin()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var definition = Builder<NewznabDefinition>.CreateNew()
|
|
|
|
|
|
|
|
.With(d => d.Url = "http://www.nzbdrone2.com")
|
|
|
|
|
|
|
|
.With(d => d.BuiltIn = false)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var db = TestDbHelper.GetEmptyDatabase();
|
|
|
|
|
|
|
|
Mocker.SetConstant(db);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.Insert(definition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(new List<NewznabDefinition>{ definition });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
var result = db.Fetch<NewznabDefinition>();
|
|
|
|
|
|
|
|
result.Should().HaveCount(1);
|
|
|
|
|
|
|
|
result.First().BuiltIn.Should().BeTrue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|