Skip to content

Commit 652edae

Browse files
committed
Switching local DB tests to use SQL Server Express / Extra test coverage for runtime-type mapping
1 parent efea0be commit 652edae

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

AgileMapper.UnitTests.Orms/TestConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static string GetLocalDbConnectionString<TDbContext>()
1515
dbName = dbName.Substring(0, dbName.Length - "Context".Length);
1616
}
1717

18-
return "Data Source=(local);" +
18+
return "Data Source=(local)\\SQLExpress;" +
1919
"Initial Catalog=" + dbName + ";" +
2020
"Integrated Security=True;" +
2121
"MultipleActiveResultSets=True";

AgileMapper.UnitTests/WhenMappingToNewComplexTypeMembers.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
namespace AgileObjects.AgileMapper.UnitTests
22
{
33
using System.Collections.Generic;
4+
using AgileMapper.Extensions;
5+
using AgileMapper.Extensions.Internal;
46
using TestClasses;
57
using Xunit;
68

@@ -334,6 +336,32 @@ public void ShouldHandleRuntimeTypedComplexAndEnumerableChildMembers()
334336
}
335337
}
336338

339+
[Fact]
340+
public void ShouldHandleRuntimeTypedComplexAndEnumerableElementMembers()
341+
{
342+
var source = new PublicTwoFields<object, IList<object>>
343+
{
344+
Value1 = new Product { ProductId = "kjdfskjnds" },
345+
Value2 = new List<object>
346+
{
347+
new PublicProperty<string> { Value = "ikjhfeslkjdw" },
348+
new PublicField<string> { Value = "ldkjkdhusdiuoji" }
349+
}
350+
};
351+
352+
var result = source.DeepClone();
353+
354+
result.Value1.ShouldBeOfType<Product>();
355+
((Product)result.Value1).ProductId.ShouldBe("kjdfskjnds");
356+
357+
result.Value2.Count.ShouldBe(2);
358+
result.Value2.First().ShouldBeOfType<PublicProperty<string>>();
359+
((PublicProperty<string>)result.Value2.First()).Value.ShouldBe("ikjhfeslkjdw");
360+
361+
result.Value2.Second().ShouldBeOfType<PublicField<string>>();
362+
((PublicField<string>)result.Value2.Second()).Value.ShouldBe("ldkjkdhusdiuoji");
363+
}
364+
337365
#region Helper Classes
338366

339367
private class Country

0 commit comments

Comments
 (0)