Skip to content

Commit

Permalink
add Constract Using Test
Browse files Browse the repository at this point in the history
  • Loading branch information
DocSvartz committed Jan 4, 2025
1 parent 4deea1a commit a8baff8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Mapster.Tests/WhenMappingInitProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ public void WhenMappingToHiddenandNewInitFieldDestination()
s.Id.ShouldBe(156);
}

[TestMethod]
public void WhenMappingToHiddenandNewInitFieldWithConstructUsing()
{
TypeAdapterConfig<Source672, BDestination>.NewConfig().ConstructUsing(_ => new BDestination());


var source = new Source672() { Id = 256 };
var c = source.Adapt<BDestination>();
var s = source.Adapt(new BDestination());

((ADestination)c).Id.ShouldBe(256);
s.Id.ShouldBe(256);
}


#endregion Tests


Expand Down

0 comments on commit a8baff8

Please sign in to comment.