Exemplo n.º 1
0
        public void IsInHistory_NotInHistory_ReturnsFalse()
        {
            var sabRequest = new MockSabRequest { InputXml = XDocument.Load("SabHistory.xml") };
            ISabService sabService = new SabService(new Config(), sabRequest);
            var episode = new Episode
            {
                ShowName = "Stargate Universe",
                SeasonNumber = 2,
                EpisodeNumber = 1
            };

            bool actual = sabService.IsInHistory(episode);

            Expect(actual, Is.False);
        }
Exemplo n.º 2
0
        public void IsInHistory_ErrorResult_ReturnsFalse()
        {
            var input = new StringReader(
                @"<?xml version=""1.0"" encoding=""UTF-8"" ?>
                    <result><status>False</status>
                        <error>API Key Required</error>
                    </result>");
            var sabRequest = new MockSabRequest { InputXml = XDocument.Load(input) };
            ISabService sabService = new SabService(new Config(), sabRequest);
            var episode = new Episode
            {
                ShowName = "Stargate Universe",
                SeasonNumber = 1,
                EpisodeNumber = 19
            };

            bool actual = sabService.IsInHistory(episode);

            Expect(actual, Is.False);
        }
Exemplo n.º 3
0
        // GET: Layout
        public ActionResult ApplicationMenu()
        {
            var model = new List <LayoutModel>();

            foreach (var app in Enum.GetValues(typeof(Applications)))
            {
                switch ((Applications)app)
                {
                case Applications.SabNZBD:
                    var sabService = SabService.GetSettings();
                    if (sabService.Enabled)
                    {
                        model.Add(
                            new LayoutModel {
                            Name = "SabNzbd", Url = "/SabNzbd"
                        });
                    }
                    break;

                case Applications.Sickbeard: break;

                case Applications.CouchPotato:
                    var cpService = CpService.GetSettings();
                    if (cpService.Enabled)
                    {
                        model.Add(
                            new LayoutModel {
                            Name = "CouchPotato", Url = "/CouchPotato"
                        });
                    }
                    break;

                case Applications.Kodi: break;

                case Applications.Sonarr:
                    var sonarrService = SonarrService.GetSettings();
                    if (sonarrService.Enabled)
                    {
                        model.Add(
                            new LayoutModel {
                            Name = "Sonarr", Url = "/Sonarr"
                        });
                    }
                    break;

                case Applications.Plex:
                    var plexService = PlexService.GetSettings();
                    if (plexService.Enabled)
                    {
                        model.Add(
                            new LayoutModel {
                            Name = "Plex", Url = "/Plex"
                        });
                    }
                    break;

                case Applications.NzbGet:
                    var nzbgetService = NzbService.GetSettings();
                    if (nzbgetService.Enabled)
                    {
                        model.Add(
                            new LayoutModel {
                            Name = "NzbGet", Url = "/NzbGet"
                        });
                    }
                    break;

                case Applications.Headphones: break;

                default:
                    throw new ArgumentOutOfRangeException("application");
                }
            }

            return(PartialView("NavBarItems", model));
        }
Exemplo n.º 4
0
 public MockSabService()
 {
     var sabRequest = new MockSabRequest { InputXml = XDocument.Load("SabHistory.xml") };
     Service = new SabService(new Config(), sabRequest);
 }