* Stylecop Rules and Fixes
This commit is contained in:
Qstick
2020-01-03 07:49:24 -05:00
committed by GitHub
parent 63d669178d
commit f77a2feeef
1307 changed files with 8704 additions and 7404 deletions
@@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.IndexerTests.GazelleTests
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET && v.Url.FullUri.Contains("ajax.php?action=browse"))))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader{ContentType = "application/json" }, recentFeed));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader { ContentType = "application/json" }, recentFeed));
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST && v.Url.FullUri.Contains("ajax.php?action=index"))))
@@ -20,15 +20,15 @@ namespace NzbDrone.Core.Test.IndexerTests.HeadphonesTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Headphones VIP",
Settings = new HeadphonesSettings()
{
Name = "Headphones VIP",
Settings = new HeadphonesSettings()
{
Categories = new int[] { 3000 },
Username = "user",
Password = "pass"
}
};
Categories = new int[] { 3000 },
Username = "user",
Password = "pass"
}
};
_caps = new HeadphonesCapabilities();
Mocker.GetMock<IHeadphonesCapabilitiesProvider>()
@@ -1,3 +1,6 @@
using System;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
@@ -5,9 +8,6 @@ using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.IPTorrents;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using System;
using System.Linq;
using FluentAssertions;
namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
{
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "IPTorrents",
Settings = new IPTorrentsSettings() { BaseUrl = "http://fake.com/" }
};
{
Name = "IPTorrents",
Settings = new IPTorrentsSettings() { BaseUrl = "http://fake.com/" }
};
}
private void GivenOldFeedFormat()
@@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
Subject.Definition = new IndexerDefinition()
{
Name = "IPTorrents",
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/torrents/rss?u=snip;tp=snip;3;80;93;37;download" }
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/torrents/rss?u=snip;tp=snip;3;80;93;37;download" }
};
}
@@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
Subject.Definition = new IndexerDefinition()
{
Name = "IPTorrents",
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/t.rss?u=USERID;tp=APIKEY;3;80;93;37;download" }
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/t.rss?u=USERID;tp=APIKEY;3;80;93;37;download" }
};
}
@@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
Subject.Definition = new IndexerDefinition()
{
Name = "IPTorrents",
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/t.rss?u=USERID;tp=APIKEY;3;80;93;37" }
Settings = new IPTorrentsSettings() { BaseUrl = "https://iptorrents.com/t.rss?u=USERID;tp=APIKEY;3;80;93;37" }
};
}
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.IndexerTests
Mocker.SetConstant<IIndexerRepository>(repo);
var existingIndexers = Builder<IndexerDefinition>.CreateNew().BuildNew();
existingIndexers.ConfigContract = typeof (NewznabSettings).Name;
existingIndexers.ConfigContract = typeof(NewznabSettings).Name;
repo.Insert(existingIndexers);
@@ -4,11 +4,9 @@ using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Nyaa;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Test.Common.Categories;
namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
@@ -24,8 +22,8 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
UseRealHttp();
_albumSearchCriteria = new AlbumSearchCriteria()
{
};
{
};
}
private void ValidateTorrentResult(IList<ReleaseInfo> reports, bool hasSize = false, bool hasInfoUrl = false, bool hasMagnet = false)
@@ -60,6 +58,5 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
reports.Should().OnlyContain(c => c.Size > 0);
}
}
}
}
@@ -21,15 +21,15 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Id = 5,
Name = "Newznab",
Settings = new NewznabSettings()
{
Id = 5,
Name = "Newznab",
Settings = new NewznabSettings()
{
BaseUrl = "http://indexer.local/",
Categories = new int[] { 1 }
}
};
BaseUrl = "http://indexer.local/",
Categories = new int[] { 1 }
}
};
_caps = new NewznabCapabilities();
Mocker.GetMock<INewznabCapabilitiesProvider>()
@@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent();
releases.Should().HaveCount(100);
@@ -93,5 +93,5 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
ExceptionVerification.ExpectedWarns(1);
}
}
}
}
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Moq;
@@ -19,16 +18,15 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{
Subject.Settings = new NewznabSettings()
{
BaseUrl = "http://127.0.0.1:1234/",
Categories = new [] { 1, 2 },
ApiKey = "abcd",
BaseUrl = "http://127.0.0.1:1234/",
Categories = new[] { 1, 2 },
ApiKey = "abcd",
};
_singleAlbumSearchCriteria = new AlbumSearchCriteria
{
Artist = new Music.Artist { Name = "Alien Ant Farm" },
AlbumTitle = "TruANT"
};
_capabilities = new NewznabCapabilities();
@@ -53,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
[Test]
public void should_search_by_artist_and_album_if_supported()
{
_capabilities.SupportedAudioSearchParameters = new[] { "q", "artist", "album"};
_capabilities.SupportedAudioSearchParameters = new[] { "q", "artist", "album" };
var results = Subject.GetSearchRequests(_singleAlbumSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
@@ -7,7 +7,6 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{
public class NewznabSettingFixture : CoreTest
{
[TestCase("http://nzbs.org")]
[TestCase("http:///www.nzbplanet.net")]
public void requires_apikey(string url)
@@ -18,10 +17,8 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
BaseUrl = url
};
setting.Validate().IsValid.Should().BeFalse();
setting.Validate().Errors.Should().Contain(c => c.PropertyName == "ApiKey");
}
[TestCase("")]
@@ -35,14 +32,11 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
BaseUrl = url
};
setting.Validate().IsValid.Should().BeFalse();
setting.Validate().Errors.Should().NotContain(c => c.PropertyName == "ApiKey");
setting.Validate().Errors.Should().Contain(c => c.PropertyName == "BaseUrl");
}
[TestCase("http://nzbs2.org")]
public void doesnt_requires_apikey(string url)
{
@@ -52,7 +46,6 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
BaseUrl = url
};
setting.Validate().IsValid.Should().BeTrue();
}
}
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.Test.IndexerTests.NyaaTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Nyaa",
Settings = new NyaaSettings()
};
{
Name = "Nyaa",
Settings = new NyaaSettings()
};
}
[Test]
@@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NyaaTests
torrentInfo.Size.Should().Be(2523293286); //2.35 GiB
torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(2+1);
torrentInfo.Peers.Should().Be(2 + 1);
torrentInfo.Seeders.Should().Be(1);
}
}
@@ -17,14 +17,14 @@ namespace NzbDrone.Core.Test.IndexerTests.OmgwtfnzbsTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Omgwtfnzbs",
Settings = new OmgwtfnzbsSettings()
{
Name = "Omgwtfnzbs",
Settings = new OmgwtfnzbsSettings()
{
ApiKey = "xxx",
Username = "me@my.domain"
}
};
ApiKey = "xxx",
Username = "me@my.domain"
}
};
}
[Test]
@@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.IndexerTests.OmgwtfnzbsTests
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent();
releases.Should().HaveCount(100);
@@ -19,10 +19,10 @@ namespace NzbDrone.Core.Test.IndexerTests.RarbgTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Rarbg",
Settings = new RarbgSettings()
};
{
Name = "Rarbg",
Settings = new RarbgSettings()
};
Mocker.GetMock<IRarbgTokenProvider>()
.Setup(v => v.GetToken(It.IsAny<RarbgSettings>()))
@@ -18,7 +18,6 @@ namespace NzbDrone.Core.Test.IndexerTests
public TestIndexer(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
: base(httpClient, indexerStatusService, configService, parsingService, logger)
{
}
public IIndexerRequestGenerator _requestGenerator;
@@ -1,6 +1,5 @@
using System;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Test.IndexerTests
@@ -1,13 +1,13 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NLog;
using NLog.Config;
using NLog.Targets;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.TorrentRss;
using NzbDrone.Core.Parser;
using NLog.Config;
using NLog.Targets;
namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
{
@@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
public List<ValidationFailure> TestPublic()
{
var result = new List<ValidationFailure>();
this.SetupNLog(); // Enable this to enable trace logging with nlog for debugging purposes
SetupNLog(); // Enable this to enable trace logging with nlog for debugging purposes
Test(result);
return result;
}
@@ -31,13 +31,13 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
/// </summary>
private void SetupNLog()
{
// Step 1. Create configuration object
// Step 1. Create configuration object
var config = new LoggingConfiguration();
var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget);
// Step 3. Set target properties
// Step 3. Set target properties
fileTarget.FileName = "${basedir}/log.txt";
fileTarget.Layout = GetStandardLayout();
@@ -5,7 +5,6 @@ using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Indexers.TorrentRss;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
@@ -13,7 +12,6 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
{
[TestFixture]
public class TorrentRssIndexerFixture : CoreTest<TestTorrentRssIndexer>
{
@@ -220,7 +218,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
torrentInfo.CommentUrl.Should().Be("https://animetosho.org/view/fff-ore-monogatari-vol-01-bd-720p-aac.1009077");
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
torrentInfo.PublishDate.Should().Be(DateTime.Parse("Tue, 02 Aug 2016 13:48:04 +0000").ToUniversalTime());
torrentInfo.Size.Should().Be((long)Math.Round((double)1.366m * 1024L * 1024L * 1024L));
torrentInfo.Size.Should().Be((long)Math.Round(1.366D * 1024L * 1024L * 1024L));
torrentInfo.InfoHash.Should().BeNull();
torrentInfo.MagnetUrl.Should().BeNull();
torrentInfo.Peers.Should().NotHaveValue();
@@ -288,7 +286,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
torrentInfo.Seeders.Should().NotHaveValue();
}
[Test]
[Test]
public void should_record_indexer_failure_if_unsupported_feed()
{
GivenRecentFeedResponse("TorrentRss/invalid/TorrentDay_NoPubDate.xml");
@@ -1,11 +1,11 @@
using Moq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Cache;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Indexers.TorrentRss;
using NzbDrone.Core.Test.Framework;
using FluentAssertions;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Indexers;
namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
{
@@ -5,7 +5,6 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Indexers.TorrentRss;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
{
@@ -38,14 +37,14 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = true,
UseEnclosureUrl = false,
UseEnclosureLength = false,
ParseSizeInDescription = false,
ParseSeedersInDescription = false,
SizeElementName = null
});
{
UseEZTVFormat = true,
UseEnclosureUrl = false,
UseEnclosureLength = false,
ParseSizeInDescription = false,
ParseSeedersInDescription = false,
SizeElementName = null
});
}
[Test]
@@ -1,13 +1,13 @@
using Moq;
using System;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Torrentleech;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using System;
using System.Linq;
using FluentAssertions;
namespace NzbDrone.Core.Test.IndexerTests.TorrentleechTests
{
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentleechTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Torrentleech",
Settings = new TorrentleechSettings()
};
{
Name = "Torrentleech",
Settings = new TorrentleechSettings()
};
}
[Test]
@@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentleechTests
torrentInfo.Size.Should().Be(0);
torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(7+1);
torrentInfo.Peers.Should().Be(7 + 1);
torrentInfo.Seeders.Should().Be(1);
}
}
@@ -21,14 +21,14 @@ namespace NzbDrone.Core.Test.IndexerTests.TorznabTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Torznab",
Settings = new TorznabSettings()
{
Name = "Torznab",
Settings = new TorznabSettings()
{
BaseUrl = "http://indexer.local/",
Categories = new int[] { 1 }
}
};
BaseUrl = "http://indexer.local/",
Categories = new int[] { 1 }
}
};
_caps = new NewznabCapabilities();
Mocker.GetMock<INewznabCapabilitiesProvider>()
@@ -17,14 +17,14 @@ namespace NzbDrone.Core.Test.IndexerTests.WafflesTests
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "Waffles",
Settings = new WafflesSettings()
{
Name = "Waffles",
Settings = new WafflesSettings()
{
UserId = "xxx",
RssPasskey = "123456789"
}
};
UserId = "xxx",
RssPasskey = "123456789"
}
};
}
[Test]
@@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.IndexerTests.WafflesTests
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent();
releases.Should().HaveCount(15);