本文整理汇总了C#中Source.Map方法的典型用法代码示例。如果您正苦于以下问题:C# Source.Map方法的具体用法?C# Source.Map怎么用?C# Source.Map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source.Map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ManualMapGeneralTest
public void ManualMapGeneralTest()
{
ManualMap<Source, Target> map = ManualMap<Source, Target>.New
.AddMap(a => a.Source1, b => b.Target1)
.AddMap(a => a.Source2, b => b.Target2)
.AddMap(a => a.Source3, b => b.Target3)
.AddMap(a => a.Source4, b => b.Target4)
.AddMap(a => a.Source5, b => b.Target5);
Guid guid = Guid.NewGuid();
Source source = new Source(1, "as", null, guid, 2);
Target target = new Target();
Assert.That(target.Target1, Is.EqualTo(default(int)));
Assert.That(target.Target2, Is.EqualTo(default(string)));
Assert.That(target.Target3, Is.EqualTo(default(object)));
Assert.That(target.Target4, Is.EqualTo(default(Guid)));
Assert.That(target.Target5, Is.EqualTo(default(int)));
target = source.Map(map);
Assert.That(target.Target1, Is.EqualTo(source.Source1));
Assert.That(target.Target2, Is.EqualTo(source.Source2));
Assert.That(target.Target3, Is.EqualTo(source.Source3));
Assert.That(target.Target4, Is.EqualTo(source.Source4));
Assert.That(target.Target5, Is.EqualTo(source.Source5));
}