mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Added support for embedding lists of IEmbeddedDocument types.
This commit is contained in:
parent
b16d85d0fc
commit
57120c9eeb
4 changed files with 75 additions and 6 deletions
55
NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs
Normal file
55
NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
{
|
||||
[TestFixture]
|
||||
public class MappingExtensionFixture
|
||||
{
|
||||
|
||||
public class EmbeddedType : IEmbeddedDocument
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class TypeWithAllMappableProperties
|
||||
{
|
||||
public string PropString { get; set; }
|
||||
public int PropInt { get; set; }
|
||||
public bool PropBool { get; set; }
|
||||
public Nullable<int> PropNullable { get; set; }
|
||||
public EmbeddedType Embedded { get; set; }
|
||||
public List<EmbeddedType> EmbeddedList { get; set; }
|
||||
}
|
||||
|
||||
public class TypeWithNoMappableProperties
|
||||
{
|
||||
public Series Series { get; set; }
|
||||
public List<string> ListOfStrings { get; set; }
|
||||
|
||||
public int ReadOnly { get; private set; }
|
||||
public int WriteOnly { private get; set; }
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void test_mappable_types()
|
||||
{
|
||||
var properties = typeof(TypeWithAllMappableProperties).GetProperties();
|
||||
properties.Should().NotBeEmpty();
|
||||
properties.Should().OnlyContain(c => MappingExtensions.IsMappableProperty(c));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void test_un_mappable_types()
|
||||
{
|
||||
var properties = typeof(TypeWithNoMappableProperties).GetProperties();
|
||||
properties.Should().NotBeEmpty();
|
||||
properties.Should().NotContain(c => MappingExtensions.IsMappableProperty(c));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue