You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/NzbDrone.Core.Test/SeriesTest.cs

56 lines
1.8 KiB

14 years ago
using System;
using System.Collections;
14 years ago
using System.Collections.Generic;
using System.Text;
using FizzWare.NBuilder;
14 years ago
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq;
using Ninject;
using Ninject.Moq;
14 years ago
using NzbDrone.Core.Controllers;
using NzbDrone.Core.Repository;
using SubSonic.Repository;
using TvdbLib.Data;
14 years ago
// ReSharper disable InconsistentNaming
namespace NzbDrone.Core.Test
{
[TestFixture]
public class SeriesTest
{
[Test]
[Description("This test will confirm that a folder will be skipped if it has been resolved to a series already assigned to another folder")]
public void skip_same_series_diffrent_folder()
{
var tvDbId = 1234;
14 years ago
//Arrange
var moqData = new Mock<IRepository>();
var moqTvdb = new Mock<ITvDbController>();
//setup db to return a fake series
Series fakeSeries = Builder<Series>.CreateNew()
.With(f => f.TvdbId = tvDbId.ToString())
.Build();
moqData.Setup(f => f.Single<Series>(tvDbId)).
Returns(fakeSeries);
//setup tvdb to return the same show,
IList<TvdbSearchResult> fakeSearchResult = Builder<TvdbSearchResult>.CreateListOfSize(4).WhereTheFirst(1).Has(f => f.Id = tvDbId).Build();
moqTvdb.Setup(f => f.SearchSeries(It.IsAny<string>())).
Returns(fakeSearchResult);
var kernel = new MockingKernel();
kernel.Bind<IRepository>().ToConstant(moqData.Object);
kernel.Bind<ITvDbController>().ToConstant(moqTvdb.Object);
var seriesController = kernel.Get<ISeriesController>();
seriesController.a
14 years ago
}
}
}