#region Copyright // /************************************************************************ // Copyright (c) 2016 Jamie Rees // File: PlexAvailabilityCheckerTests.cs // Created By: Jamie Rees // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion using System; using Moq; using NUnit.Framework; using PlexRequests.Api.Interfaces; using PlexRequests.Core; using PlexRequests.Core.SettingModels; using PlexRequests.Services.Interfaces; using PlexRequests.Helpers; using PlexRequests.Services.Jobs; using PlexRequests.Store.Models; using PlexRequests.Store.Repository; namespace PlexRequests.Services.Tests { [TestFixture] public class PlexAvailabilityCheckerTests { public IAvailabilityChecker Checker { get; set; } private Mock> SettingsMock { get; set; } private Mock> AuthMock { get; set; } private Mock RequestMock { get; set; } private Mock PlexMock { get; set; } private Mock CacheMock { get; set; } private Mock NotificationMock { get; set; } private Mock JobRec { get; set; } private Mock> NotifyUsers { get; set; } [SetUp] public void Setup() { SettingsMock = new Mock>(); AuthMock = new Mock>(); RequestMock = new Mock(); PlexMock = new Mock(); NotificationMock = new Mock(); CacheMock = new Mock(); NotifyUsers = new Mock>(); JobRec = new Mock(); Checker = new PlexAvailabilityChecker(SettingsMock.Object, AuthMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object); } [Test] public void InvalidSettings() { Checker.CheckAndUpdateAll(); PlexMock.Verify(x => x.GetLibrary(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); PlexMock.Verify(x => x.GetAccount(It.IsAny()), Times.Never); PlexMock.Verify(x => x.GetLibrarySections(It.IsAny(), It.IsAny()), Times.Never); PlexMock.Verify(x => x.GetStatus(It.IsAny(), It.IsAny()), Times.Never); PlexMock.Verify(x => x.GetUsers(It.IsAny()), Times.Never); } //[Test] //public void IsAvailableTest() //{ // var settingsMock = new Mock>(); // var authMock = new Mock>(); // var requestMock = new Mock(); // var plexMock = new Mock(); // var cacheMock = new Mock(); // var searchResult = new PlexSearch { Video = new List