context: using FluentAssertions;
  using Moq;
  using NUnit.Framework;
  using NzbDrone.Common.Http;
  using NzbDrone.Core.Indexers.Exceptions;
  using NzbDrone.Core.Indexers.TorrentRss;
  using NzbDrone.Core.Test.Framework;
  
  namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
  {
      [TestFixture]
      public class TorrentRssSettingsDetectorFixture : CoreTest<TorrentRssSettingsDetector>
      {
          private const string _indexerUrl = "http://my.indexer.tv/recent";
          private TorrentRssIndexerSettings _indexerSettings;
  
          [SetUp]
          public void SetUp()
          {
              _indexerSettings = new TorrentRssIndexerSettings { BaseUrl = _indexerUrl };
          }
  
          private void GivenRecentFeedResponse(string rssXmlFile)
          {
              var recentFeed = ReadAllText(@"Files/Indexers/" + rssXmlFile);
  
              Mocker.GetMock<IHttpClient>()
                  .Setup(o => o.Execute(It.IsAny<HttpRequest>()))
                  .Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
          }
  
          [Test]
          public void should_detect_rss_settings_for_ezrss()
          {
              GivenRecentFeedResponse("TorrentRss/Ezrss.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = true,
                  UseEnclosureUrl = false,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_speed_cd()
          {
              GivenRecentFeedResponse("TorrentRss/speed.cd.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = false,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = true,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_ImmortalSeed()
          {
              GivenRecentFeedResponse("TorrentRss/ImmortalSeed.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = false,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = true,
                  ParseSeedersInDescription = true,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_ShowRSS_info()
          {
              _indexerSettings.AllowZeroSize = true;
  
              GivenRecentFeedResponse("TorrentRss/ShowRSS.info.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = true,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_TransmitTheNet()
          {
              GivenRecentFeedResponse("TorrentRss/TransmitTheNet.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = true,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = true,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_BitHdtv()
          {
              GivenRecentFeedResponse("TorrentRss/BitHdtv.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = false,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = "size"
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_Doki()
          {
              _indexerSettings.AllowZeroSize = true;
  
              GivenRecentFeedResponse("TorrentRss/Doki.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = true,
                  UseEnclosureLength = false,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_ExtraTorrents()
          {
              _indexerSettings.AllowZeroSize = true;
  
              GivenRecentFeedResponse("TorrentRss/ExtraTorrents.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = true,
                  UseEnclosureLength = true,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_LimeTorrents()
          {
              _indexerSettings.AllowZeroSize = true;
  
              GivenRecentFeedResponse("TorrentRss/LimeTorrents.xml");
  
              var settings = Subject.Detect(_indexerSettings);
  
              settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
              {
                  UseEZTVFormat = false,
                  UseEnclosureUrl = true,
                  UseEnclosureLength = true,
                  ParseSizeInDescription = false,
                  ParseSeedersInDescription = false,
                  SizeElementName = null
              });
          }
  
          [Test]
          public void should_detect_rss_settings_for_AlphaRatio()
          {
              _indexerSettings.AllowZeroSize = true;
  
              GivenRecentFeedResponse("TorrentRss/AlphaRatio.xml");
  
  
gt:             var settings = Subject.Detect(_indexerSettings);