从山证v2.3.0拷贝
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace YLErp.Basic
|
||||
{
|
||||
[TestClass]
|
||||
public class AutoMapperTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestDictionToObject()
|
||||
{
|
||||
var dic = new Dictionary<string, object> {
|
||||
{"AA","11" },
|
||||
{"BB","22" }
|
||||
};
|
||||
|
||||
var poco = new Mapper(new MapperConfiguration(cfg => { })).Map<TestPoco>(dic);
|
||||
|
||||
Assert.IsTrue(poco.AA == "11" && poco.BB == "22");
|
||||
|
||||
dic = new Dictionary<string, object> {
|
||||
{"AA","33" },
|
||||
{"BB","44" }
|
||||
};
|
||||
|
||||
new Mapper(new MapperConfiguration(cfg => { })).Map(dic, poco);
|
||||
|
||||
Assert.IsTrue(poco.AA == "33" && poco.BB == "44");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user