tests/DotNetCommon.Test/Extensions/ObjectTests_MapperModify.cs
(开头部分) 14KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using DotNetCommon.Extensions;
using Shouldly;
using DotNetCommon.Data;
using System.Linq;
namespace DotNetCommon.Test.Extensions
{
/// <summary>
/// 测试Object.MapperModify()方法
/// </summary>
[TestFixture]
public class ObjectTests_MapperModify
{
#region 转换示例
[Test]
public void MapperWithBaseObj()
{
var stu = new StudentEntity()
{
Id = 1,
Name = "小明",
Birth = DateTime.Parse("1988-01-01"),
Nicks = new List<string>() { "小张", "小明" },
Score = 98.2,
Books = new List<Book>()
{
new Book()
{
Id=1,
Name="语文"
},
new Book()
{
Id=2,
Name="数学"
}
},
Manage = new StudentEntity()
{
Id = 2,
Name = "小花",
Score = 99,
Birth = DateTime.Parse("2000-02-01"),
Nicks = new List<string>() { "小花", "xiaohua" }
}
};
var stuReq = new StudentReq()
{
Id = 1,
Name = "小明2",
Score = 85,
Nicks = new List<string>() { "小明2" },
Manage = new StudentReq()
{
Id = 3,
Name = "小刚",
后面还有 401 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
