wsd_djy/WebSiteCode/Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs
2019-03-06 16:26:07 +08:00

47 lines
1.3 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Cmdjy.Bll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cmdjy.Bll.Tests
{
[TestClass()]
public class ObjExtendTests
{
[TestMethod()]
public void CopyFromTest() {
var s = new a { inta = 1,strb = "abc",c = 2,e = "eee",f = "6",g = 7 };
var t = new b { intd = 3,e = 4,f = 1,};
t.CopyFrom(s);
Assert.AreEqual(s.inta,t.inta);
Assert.AreEqual(s.strb,t.strb);
Assert.IsTrue(s.c == 2);
Assert.IsTrue(t.intd == 3);
Assert.IsTrue(t.e == 4);
Assert.IsTrue(t.f == 1);
//Assert.IsTrue(t.g == 7);
}
}
public class a
{
public int inta { get; set; }
public string strb { get; set; }
public int c { get; set; }
public string e { get; set; }
public string f { get; set; }
public int g { get; set; }
}
public class b
{
public int inta { get; set; }
public string strb { get; set; }
public int intd { get; set; }
public int e { get; set; }
public int f { get; set; }
public double g { get; set; }
}
}