using System.Collections.Generic; using Moq; using NUnit.Framework; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { [TestFixture] // ReSharper disable InconsistentNaming public class SeriesSearchJobTest : CoreTest { [Test] public void SeriesSearch_success() { var seasons = new List { 1, 2, 3, 4, 5 }; var mocker = new AutoMoqer(MockBehavior.Strict); var notification = new ProgressNotification("Series Search"); mocker.GetMock() .Setup(c => c.GetSeasons(1)).Returns(seasons); mocker.GetMock() .Setup(c => c.IsIgnored(It.IsAny(), It.IsAny())).Returns(false); mocker.GetMock() .Setup(c => c.Start(notification, 1, It.IsAny())).Verifiable(); //Act mocker.Resolve().Start(notification, 1, 0); //Assert mocker.VerifyAllMocks(); mocker.GetMock().Verify(c => c.Start(notification, 1, It.IsAny()), Times.Exactly(seasons.Count)); } [Test] public void SeriesSearch_no_seasons() { var seasons = new List(); var mocker = new AutoMoqer(MockBehavior.Strict); var notification = new ProgressNotification("Series Search"); mocker.GetMock() .Setup(c => c.GetSeasons(1)).Returns(seasons); //Act mocker.Resolve().Start(notification, 1, 0); //Assert mocker.VerifyAllMocks(); mocker.GetMock().Verify(c => c.Start(notification, 1, It.IsAny()), Times.Never()); } } }