mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
added resource mapping validation tests
This commit is contained in:
parent
1d49435675
commit
c3214a2e88
17 changed files with 297 additions and 76 deletions
31
NzbDrone.Api.Test/MappingTests/ReflectionExtensionFixture.cs
Normal file
31
NzbDrone.Api.Test/MappingTests/ReflectionExtensionFixture.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System.Reflection;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Api.Test.MappingTests
|
||||
{
|
||||
public class ReflectionExtensionFixture : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void should_get_properties_from_models()
|
||||
{
|
||||
var models = Assembly.Load("NzbDrone.Core").ImplementationsOf<ModelBase>();
|
||||
|
||||
foreach (var model in models)
|
||||
{
|
||||
model.GetSimpleProperties().Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_get_implementations()
|
||||
{
|
||||
var models = Assembly.Load("NzbDrone.Core").ImplementationsOf<ModelBase>();
|
||||
|
||||
models.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
21
NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs
Normal file
21
NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using NzbDrone.Api.Mapping;
|
||||
using NzbDrone.Api.Series;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Api.Test.MappingTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ResourceMappingFixture : TestBase
|
||||
{
|
||||
[TestCase(typeof(Core.Tv.Series), typeof(SeriesResource))]
|
||||
[TestCase(typeof(Core.Tv.Episode), typeof(EpisodeResource))]
|
||||
public void matching_fields(Type modelType, Type resourceType)
|
||||
{
|
||||
MappingValidation.ValidateMapping(modelType, resourceType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -50,9 +50,19 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FizzWare.NBuilder">
|
||||
<HintPath>..\packages\NBuilder.3.0.1.1\lib\FizzWare.NBuilder.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\FluentAssertions.2.0.1\lib\net40\FluentAssertions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Omu.ValueInjecter">
|
||||
<HintPath>..\packages\valueinjecter.2.3.3\lib\net35\Omu.ValueInjecter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
@ -62,6 +72,8 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MappingTests\ReflectionExtensionFixture.cs" />
|
||||
<Compile Include="MappingTests\ResourceMappingFixture.cs" />
|
||||
<Compile Include="StaticResourceMapperFixture.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FluentAssertions" version="2.0.1" targetFramework="net40" />
|
||||
<package id="NBuilder" version="3.0.1.1" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.2" targetFramework="net40" />
|
||||
<package id="valueinjecter" version="2.3.3" targetFramework="net40" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue