Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chaowlert committed Aug 22, 2017
1 parent 2e07857 commit cc2fe61
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Mapster.Tests/WhenMappingWithDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void Object_To_Dictionary_CamelCase()
Name = "test",
};

var dict = TypeAdapter.Adapt<Dictionary<string, object>>(poco);
var dict = TypeAdapter.Adapt<SimplePoco, Dictionary<string, object>>(poco);

dict.Count.ShouldBe(2);
dict["id"].ShouldBe(poco.Id);
Expand Down Expand Up @@ -142,7 +142,6 @@ public void Dictionary_To_Object_Map()
[TestMethod]
public void Dictionary_To_Object_CamelCase()
{
TypeAdapterConfig.GlobalSettings.EnableDebugging();
TypeAdapterConfig.GlobalSettings.Default.NameMatchingStrategy(NameMatchingStrategy.FromCamelCase);
var dict = new Dictionary<string, object>
{
Expand Down Expand Up @@ -208,7 +207,7 @@ public void Dictionary_Of_String_Mix()
["d"] = 4,
["e"] = null,
};
var result = dict.Adapt<Dictionary<string, int>>();
var result = dict.Adapt<Dictionary<string, int?>, Dictionary<string, int>>();
result.Count.ShouldBe(2);
result["A"].ShouldBe(1);
result["_b"].ShouldBe(2);
Expand Down
3 changes: 1 addition & 2 deletions src/Mapster/Adapters/DictionaryAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ protected override ClassModel GetClassModel(Type destinationType, CompileArgumen
private static Func<Expression, Expression, Expression> GetFunction(CompileArgument arg, Type dictType)
{
var strategy = arg.Settings.NameMatchingStrategy;
if (arg.MapType == MapType.MapToTarget &&
strategy.DestinationMemberNameConverter != NameMatchingStrategy.Identity)
if (strategy.DestinationMemberNameConverter != NameMatchingStrategy.Identity)
{
var args = dictType.GetGenericArguments();
var getMethod = typeof(CoreExtensions).GetMethods()
Expand Down
2 changes: 1 addition & 1 deletion src/Mapster/Mapster.NetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>3.1.2</Version>
<Version>3.1.3</Version>
<RootNamespace>Mapster</RootNamespace>
</PropertyGroup>

Expand Down

0 comments on commit cc2fe61

Please sign in to comment.