removed automapper.

pull/4/head
Keivan Beigi 12 years ago
parent 5b2410da3f
commit bdf86aa4ba

@ -1,51 +0,0 @@
using System;
using AutoMapper;
using NzbDrone.Api.Calendar;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.History;
using NzbDrone.Api.Missing;
using NzbDrone.Api.Qualities;
using NzbDrone.Api.Resolvers;
using NzbDrone.Api.Series;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api
{
public static class AutomapperBootstraper
{
public static void InitializeAutomapper()
{
//QualityProfiles
Mapper.CreateMap<QualityProfile, QualityProfileResource>()
.ForMember(dest => dest.Qualities,
opt => opt.ResolveUsing<AllowedToQualitiesResolver>().FromMember(src => src.Allowed));
Mapper.CreateMap<QualityProfileResource, QualityProfile>()
.ForMember(dest => dest.Allowed,
opt => opt.ResolveUsing<QualitiesToAllowedResolver>().FromMember(src => src.Qualities));
Mapper.CreateMap<Quality, QualityProfileType>()
.ForMember(dest => dest.Allowed, opt => opt.Ignore());
//QualitySize
Mapper.CreateMap<QualitySize, QualitySizeResource>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityId));
Mapper.CreateMap<QualitySizeResource, QualitySize>()
.ForMember(dest => dest.QualityId, opt => opt.MapFrom(src => src.Id));
//Episode
Mapper.CreateMap<Episode, EpisodeResource>();
//Episode Paging
Mapper.CreateMap<PagingSpec<Episode>, PagingResource<EpisodeResource>>();
//History
Mapper.CreateMap<Core.History.History, HistoryResource>();
Mapper.CreateMap<PagingSpec<Core.History.History>, PagingResource<HistoryResource>>();
}
}
}

@ -1,15 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Episodes; using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Api.Mapping; using NzbDrone.Api.Mapping;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Calendar namespace NzbDrone.Api.Calendar
{ {
public class CalendarModule : NzbDroneApiModule public class CalendarModule : NzbDroneRestModule<EpisodeResource>
{ {
private readonly IEpisodeService _episodeService; private readonly IEpisodeService _episodeService;
@ -17,10 +14,11 @@ namespace NzbDrone.Api.Calendar
: base("/calendar") : base("/calendar")
{ {
_episodeService = episodeService; _episodeService = episodeService;
Get["/"] = x => GetEpisodesBetweenStartAndEndDate();
GetResourceAll = GetPaged;
} }
private Response GetEpisodesBetweenStartAndEndDate() private List<EpisodeResource> GetPaged()
{ {
var start = DateTime.Today.AddDays(-1); var start = DateTime.Today.AddDays(-1);
var end = DateTime.Today.AddDays(7); var end = DateTime.Today.AddDays(7);
@ -30,10 +28,11 @@ namespace NzbDrone.Api.Calendar
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value); if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value);
if(queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value);
var episodes = _episodeService.EpisodesBetweenDates(start, end); var episodes = _episodeService.EpisodesBetweenDates(start, end);
return episodes.InjectTo<List<EpisodeResource>>().AsResponse();
return ToListResource(() => episodes);
} }
} }
} }

@ -29,12 +29,12 @@ namespace NzbDrone.Api.Config
private NamingConfigResource UpdateNamingConfig(NamingConfigResource resource) private NamingConfigResource UpdateNamingConfig(NamingConfigResource resource)
{ {
return Apply<NamingConfig>(_namingConfigService.Save, resource); return ToResource<NamingConfig>(_namingConfigService.Save, resource);
} }
private NamingConfigResource GetNamingConfig() private NamingConfigResource GetNamingConfig()
{ {
return Apply(_namingConfigService.GetConfig); return ToResource(_namingConfigService.GetConfig);
} }
} }

@ -1,13 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using NzbDrone.Api.REST;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Episodes namespace NzbDrone.Api.Episodes
{ {
public class EpisodeModule : NzbDroneApiModule public class EpisodeModule : NzbDroneRestModule<EpisodeResource>
{ {
private readonly IEpisodeService _episodeService; private readonly IEpisodeService _episodeService;
@ -15,16 +12,26 @@ namespace NzbDrone.Api.Episodes
: base("/episodes") : base("/episodes")
{ {
_episodeService = episodeService; _episodeService = episodeService;
Get["/"] = x => GetEpisodesForSeries();
GetResourceAll = GetEpisodes;
} }
private Response GetEpisodesForSeries() private List<EpisodeResource> GetEpisodes()
{ {
var seriesId = (int)Request.Query.SeriesId; var seriesId = (int?)Request.Query.SeriesId;
var seasonNumber = (int)Request.Query.SeasonNumber; var seasonNumber = (int?)Request.Query.SeasonNumber;
if (seriesId == null)
{
throw new BadRequestException("seriesId is missing");
}
if (seasonNumber == null)
{
return ToListResource(() => _episodeService.GetEpisodeBySeries(seriesId.Value));
}
var episodes = _episodeService.GetEpisodesBySeason(seriesId, seasonNumber); return ToListResource(() => _episodeService.GetEpisodesBySeason(seriesId.Value, seasonNumber.Value));
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
} }
} }
} }

@ -1,15 +1,5 @@
using System; using NzbDrone.Core.Datastore;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.History namespace NzbDrone.Api.History
{ {

@ -33,7 +33,6 @@ namespace NzbDrone.Api
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{ {
_logger.Info("Starting NzbDrone API"); _logger.Info("Starting NzbDrone API");
AutomapperBootstraper.InitializeAutomapper();
container.Resolve<DatabaseTarget>().Register(); container.Resolve<DatabaseTarget>().Register();
container.Resolve<IEnableBasicAuthInNancy>().Register(pipelines); container.Resolve<IEnableBasicAuthInNancy>().Register(pipelines);

@ -55,10 +55,6 @@
<StartupObject /> <StartupObject />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AutoMapper, Version=2.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="FluentValidation, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="FluentValidation, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentValidation.4.0.0.0\lib\Net40\FluentValidation.dll</HintPath> <HintPath>..\packages\FluentValidation.4.0.0.0\lib\Net40\FluentValidation.dll</HintPath>
@ -93,7 +89,6 @@
<Compile Include="Authentication\AuthenticationService.cs" /> <Compile Include="Authentication\AuthenticationService.cs" />
<Compile Include="Authentication\EnableBasicAuthInNancy.cs" /> <Compile Include="Authentication\EnableBasicAuthInNancy.cs" />
<Compile Include="Authentication\NzbDroneUser.cs" /> <Compile Include="Authentication\NzbDroneUser.cs" />
<Compile Include="AutomapperBootstraper.cs" />
<Compile Include="Calendar\CalendarModule.cs" /> <Compile Include="Calendar\CalendarModule.cs" />
<Compile Include="ClientSchema\SchemaDeserializer.cs" /> <Compile Include="ClientSchema\SchemaDeserializer.cs" />
<Compile Include="ClientSchema\FieldDefinitionAttribute.cs" /> <Compile Include="ClientSchema\FieldDefinitionAttribute.cs" />
@ -126,7 +121,6 @@
<Compile Include="Notifications\NotificationResource.cs" /> <Compile Include="Notifications\NotificationResource.cs" />
<Compile Include="NzbDroneRestModule.cs" /> <Compile Include="NzbDroneRestModule.cs" />
<Compile Include="PagingResource.cs" /> <Compile Include="PagingResource.cs" />
<Compile Include="Resolvers\NullableDatetimeToString.cs" />
<Compile Include="REST\BadRequestException.cs" /> <Compile Include="REST\BadRequestException.cs" />
<Compile Include="REST\ResourceValidator.cs" /> <Compile Include="REST\ResourceValidator.cs" />
<Compile Include="REST\RestModule.cs" /> <Compile Include="REST\RestModule.cs" />
@ -152,9 +146,6 @@
<Compile Include="Qualities\QualitySizeResource.cs" /> <Compile Include="Qualities\QualitySizeResource.cs" />
<Compile Include="Qualities\QualitySizeModule.cs" /> <Compile Include="Qualities\QualitySizeModule.cs" />
<Compile Include="Extensions\RequestExtensions.cs" /> <Compile Include="Extensions\RequestExtensions.cs" />
<Compile Include="Resolvers\AllowedToQualitiesResolver.cs" />
<Compile Include="Resolvers\QualitiesToAllowedResolver.cs" />
<Compile Include="Resolvers\QualityTypesToIntResolver.cs" />
<Compile Include="Config\SettingsModule.cs" /> <Compile Include="Config\SettingsModule.cs" />
<Compile Include="SignalR\BasicResourceConnection.cs" /> <Compile Include="SignalR\BasicResourceConnection.cs" />
<Compile Include="SignalR\Serializer.cs" /> <Compile Include="SignalR\Serializer.cs" />

@ -1,5 +1,4 @@
using Nancy; using Nancy;
using Nancy.Security;
namespace NzbDrone.Api namespace NzbDrone.Api
{ {

@ -22,26 +22,26 @@ namespace NzbDrone.Api
} }
protected TResource Apply<TModel>(Func<TModel, TModel> function, TResource resource) where TModel : ModelBase, new() protected TResource ToResource<TModel>(Func<TModel, TModel> function, TResource resource) where TModel : ModelBase, new()
{ {
var model = resource.InjectTo<TModel>(); var model = resource.InjectTo<TModel>();
function(model); function(model);
return model.InjectTo<TResource>(); return model.InjectTo<TResource>();
} }
protected List<TResource> ApplyToList<TModel>(Func<IEnumerable<TModel>> function) where TModel : ModelBase, new() protected List<TResource> ToListResource<TModel>(Func<IEnumerable<TModel>> function) where TModel : ModelBase, new()
{ {
var modelList = function(); var modelList = function();
return modelList.InjectTo<List<TResource>>(); return modelList.InjectTo<List<TResource>>();
} }
protected TResource Apply<TModel>(Func<TModel> function) where TModel : ModelBase, new() protected TResource ToResource<TModel>(Func<TModel> function) where TModel : ModelBase, new()
{ {
var modelList = function(); var modelList = function();
return modelList.InjectTo<TResource>(); return modelList.InjectTo<TResource>();
} }
protected TResource Apply<TModel>(Func<int, TModel> action, int id) where TModel : ModelBase, new() protected TResource ToResource<TModel>(Func<int, TModel> action, int id) where TModel : ModelBase, new()
{ {
var model = action(id); var model = action(id);
return model.InjectTo<TResource>(); return model.InjectTo<TResource>();

@ -1,17 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Api.REST;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {
public class QualityProfileResource public class QualityProfileResource : RestResource
{ {
public Int32 Id { get; set; } public Int32 Id { get; set; }
public String Name { get; set; } public String Name { get; set; }
public Int32 Cutoff { get; set; } public Int32 Cutoff { get; set; }
public List<QualityProfileType> Qualities { get; set; } public List<QualityResource> Qualities { get; set; }
} }
public class QualityProfileType public class QualityResource : RestResource
{ {
public Int32 Id { get; set; } public Int32 Id { get; set; }
public Int32 Weight { get; set; } public Int32 Weight { get; set; }

@ -1,60 +1,58 @@
using System.Collections.Generic; using System.Collections.Generic;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Api.Mapping;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {
public class QualityProfilesModule : NzbDroneApiModule public class QualityProfilesModule : NzbDroneRestModule<QualityProfileResource>
{ {
private readonly QualityProfileService _qualityProvider; private readonly QualityProfileService _qualityProvider;
public QualityProfilesModule(QualityProfileService qualityProvider) public QualityProfilesModule(QualityProfileService qualityProvider)
: base("/QualityProfiles") : base("/qualityProfiles")
{ {
_qualityProvider = qualityProvider; _qualityProvider = qualityProvider;
Get["/"] = x => OnGet();
Get["/{Id}"] = x => OnGet((int)x.Id); GetResourceAll = GetAll;
Put["/"] = x => OnPut();
Delete["/{Id}"] = x => OnDelete((int)x.Id); GetResourceById = GetById;
UpdateResource = Update;
CreateResource = Create;
DeleteResource = DeleteProfile;
} }
private Response OnGet() private QualityProfileResource Create(QualityProfileResource resource)
{ {
var profiles = _qualityProvider.All(); var model = resource.InjectTo<QualityProfile>();
return Mapper.Map<List<QualityProfile>, List<QualityProfileResource>>(profiles).AsResponse(); model = _qualityProvider.Add(model);
return GetById(model.Id);
} }
private Response OnGet(int id) private void DeleteProfile(int id)
{ {
var profile = _qualityProvider.Get(id); _qualityProvider.Delete(id);
return Mapper.Map<QualityProfile, QualityProfileResource>(profile).AsResponse();
} }
private Response OnPost() private QualityProfileResource Update(QualityProfileResource resource)
{ {
var request = Request.Body.FromJson<QualityProfileResource>(); var model = resource.InjectTo<QualityProfile>();
var profile = Mapper.Map<QualityProfileResource, QualityProfile>(request); _qualityProvider.Update(model);
request.Id = _qualityProvider.Add(profile).Id; return GetById(resource.Id);
return request.AsResponse();
} }
//Update private QualityProfileResource GetById(int id)
private Response OnPut()
{ {
var request = Request.Body.FromJson<QualityProfileResource>(); return ToResource(() => _qualityProvider.Get(id));
var profile = Mapper.Map<QualityProfileResource, QualityProfile>(request);
_qualityProvider.Update(profile);
return request.AsResponse();
} }
private Response OnDelete(int id) private List<QualityProfileResource> GetAll()
{ {
_qualityProvider.Delete(id); return ToListResource(_qualityProvider.All);
return new Response();
} }
} }
} }

@ -1,49 +1,39 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Api.Mapping;
namespace NzbDrone.Api.Qualities namespace NzbDrone.Api.Qualities
{ {
public class QualitySizeModule : NzbDroneApiModule public class QualitySizeModule : NzbDroneRestModule<QualitySizeResource>
{ {
private readonly QualitySizeService _qualityTypeProvider; private readonly QualitySizeService _qualityTypeProvider;
public QualitySizeModule(QualitySizeService qualityTypeProvider) public QualitySizeModule(QualitySizeService qualityTypeProvider)
: base("/qualitysizes")
{ {
_qualityTypeProvider = qualityTypeProvider; _qualityTypeProvider = qualityTypeProvider;
Get["/"] = x => GetQualityType(); GetResourceAll = GetAll;
Get["/{id}"] = x => GetQualityType(x.Id);
Put["/"] = x => PutQualityType();
}
private Response PutQualityType()
{
var model = Request.Body.FromJson<QualitySizeResource>();
var type = Mapper.Map<QualitySizeResource, QualitySize>(model); GetResourceById = GetById;
_qualityTypeProvider.Update(type);
return model.AsResponse();
UpdateResource = Update;
} }
private Response GetQualityType(int id) private QualitySizeResource Update(QualitySizeResource resource)
{ {
var type = _qualityTypeProvider.Get(id); var model = resource.InjectTo<QualitySize>();
return Mapper.Map<QualitySize, QualitySizeResource>(type).AsResponse(); _qualityTypeProvider.Update(model);
return GetById(resource.Id);
} }
private Response GetQualityType() private QualitySizeResource GetById(int id)
{ {
var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityId != 0 && qualityType.QualityId != 10).ToList(); return ToResource(() => _qualityTypeProvider.Get(id));
var responseModel = Mapper.Map<List<QualitySize>, List<QualitySizeResource>>(types); }
return responseModel.AsResponse(); private List<QualitySizeResource> GetAll()
{
return ToListResource(_qualityTypeProvider.All);
} }
} }
} }

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMapper;
using FluentValidation; using FluentValidation;
using Nancy; using Nancy;
using NzbDrone.Api.Extensions; using NzbDrone.Api.Extensions;
@ -189,17 +188,17 @@ namespace NzbDrone.Api.REST
private PagingResource<TResource> ReadPagingResourceFromRequest() private PagingResource<TResource> ReadPagingResourceFromRequest()
{ {
int pageSize; int pageSize;
Int32.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.PageSize), out pageSize); Int32.TryParse(Request.Query.PageSize.ToString(), out pageSize);
if (pageSize == 0) pageSize = 10; if (pageSize == 0) pageSize = 10;
int page; int page;
Int32.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.Page), out page); Int32.TryParse(Request.Query.Page.ToString(), out page);
if (page == 0) page = 1; if (page == 0) page = 1;
var sortKey = PrimitiveExtensions.ToNullSafeString(Request.Query.SortKey); var sortKey = Request.Query.SortKey.ToString();
if (String.IsNullOrEmpty(sortKey)) sortKey = "AirDate"; if (String.IsNullOrEmpty(sortKey)) sortKey = "AirDate";
var sortDirection = PrimitiveExtensions.ToNullSafeString(Request.Query.SortDir) var sortDirection = Request.Query.SortDir.ToString()
.Equals("Asc", StringComparison.InvariantCultureIgnoreCase) .Equals("Asc", StringComparison.InvariantCultureIgnoreCase)
? SortDirection.Ascending ? SortDirection.Ascending
: SortDirection.Descending; : SortDirection.Descending;

@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using NzbDrone.Api.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Api.Resolvers
{
public class AllowedToQualitiesResolver : ValueResolver<List<Quality>, List<QualityProfileType>>
{
protected override List<QualityProfileType> ResolveCore(List<Quality> source)
{
var qualities = Mapper.Map<List<Quality>, List<QualityProfileType>>(Quality.All().Where(q => q.Id > 0).ToList());
qualities.ForEach(quality =>
{
quality.Allowed = source.SingleOrDefault(q => q.Id == quality.Id) != null;
});
return qualities;
}
}
}

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
namespace NzbDrone.Api.Resolvers
{
public class NullableDatetimeToString : ValueResolver<DateTime?, String>
{
protected override String ResolveCore(DateTime? source)
{
if(!source.HasValue)
return String.Empty;
return source.Value.ToString("yyyy-MM-dd");
}
}
}

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using NzbDrone.Api.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Api.Resolvers
{
public class QualitiesToAllowedResolver : ValueResolver<List<QualityProfileType>, List<Quality>>
{
protected override List<Quality> ResolveCore(List<QualityProfileType> source)
{
var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList();
var qualityTypes = new List<Quality>();
ids.ForEach(id =>
{
qualityTypes.Add(Quality.FindById(id));
});
return qualityTypes;
}
}
}

@ -1,14 +0,0 @@
using System;
using AutoMapper;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Api.Resolvers
{
public class QualityTypesToIntResolver : ValueResolver<Quality, Int32>
{
protected override int ResolveCore(Quality source)
{
return source.Id;
}
}
}

@ -18,12 +18,12 @@ namespace NzbDrone.Api.RootFolders
private RootFolderResource CreateRootFolder(RootFolderResource rootFolderResource) private RootFolderResource CreateRootFolder(RootFolderResource rootFolderResource)
{ {
return Apply<RootFolder>(_rootFolderService.Add, rootFolderResource); return ToResource<RootFolder>(_rootFolderService.Add, rootFolderResource);
} }
private List<RootFolderResource> GetRootFolders() private List<RootFolderResource> GetRootFolders()
{ {
return ApplyToList(_rootFolderService.AllWithUnmappedFolders); return ToListResource(_rootFolderService.AllWithUnmappedFolders);
} }
private void DeleteFolder(int id) private void DeleteFolder(int id)

@ -51,7 +51,7 @@ namespace NzbDrone.Api.Series
private List<SeriesResource> AllSeries() private List<SeriesResource> AllSeries()
{ {
var seriesStats = _seriesStatisticsService.SeriesStatistics(); var seriesStats = _seriesStatisticsService.SeriesStatistics();
var seriesModels = ApplyToList(_seriesService.GetAllSeries); var seriesModels = ToListResource(_seriesService.GetAllSeries);
foreach (var s in seriesModels) foreach (var s in seriesModels)
{ {
@ -69,7 +69,7 @@ namespace NzbDrone.Api.Series
private SeriesResource GetSeries(int id) private SeriesResource GetSeries(int id)
{ {
return Apply(_seriesService.GetSeries, id); return ToResource(_seriesService.GetSeries, id);
} }
private SeriesResource AddSeries(SeriesResource seriesResource) private SeriesResource AddSeries(SeriesResource seriesResource)
@ -79,12 +79,12 @@ namespace NzbDrone.Api.Series
//(we can just create the folder and it won't blow up if it already exists) //(we can just create the folder and it won't blow up if it already exists)
//We also need to remove any special characters from the filename before attempting to create it //We also need to remove any special characters from the filename before attempting to create it
return Apply<Core.Tv.Series>(_seriesService.AddSeries, seriesResource); return ToResource<Core.Tv.Series>(_seriesService.AddSeries, seriesResource);
} }
private SeriesResource UpdateSeries(SeriesResource seriesResource) private SeriesResource UpdateSeries(SeriesResource seriesResource)
{ {
return Apply<Core.Tv.Series>(_seriesService.UpdateSeries, seriesResource); return ToResource<Core.Tv.Series>(_seriesService.UpdateSeries, seriesResource);
} }
private void DeleteSeries(int id) private void DeleteSeries(int id)

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="AutoMapper" version="2.2.1" targetFramework="net40" />
<package id="FluentValidation" version="4.0.0.0" targetFramework="net40" /> <package id="FluentValidation" version="4.0.0.0" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.Core" version="1.1.1" targetFramework="net40" /> <package id="Microsoft.AspNet.SignalR.Core" version="1.1.1" targetFramework="net40" />
<package id="Nancy" version="0.16.1" targetFramework="net40" /> <package id="Nancy" version="0.16.1" targetFramework="net40" />

@ -8,26 +8,6 @@ namespace NzbDrone.Integration.Test
[TestFixture] [TestFixture]
public class QualityProfileIntegrationTest : IntegrationTest public class QualityProfileIntegrationTest : IntegrationTest
{ {
[Test]
public void should_have_2_quality_profiles_initially()
{
RootFolders.All().Should().BeEmpty();
var rootFolder = new RootFolderResource
{
Path = Directory.GetCurrentDirectory()
};
var postResponse = RootFolders.Post(rootFolder);
postResponse.Id.Should().NotBe(0);
postResponse.FreeSpace.Should().NotBe(0);
RootFolders.All().Should().OnlyContain(c => c.Id == postResponse.Id);
RootFolders.Delete(postResponse.Id);
RootFolders.All().Should().BeEmpty();
}
} }
} }
Loading…
Cancel
Save