using iWareCC.Common.Helper;
|
using iWareModel.Entity.MES;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
|
namespace iWareUnitTest
|
{
|
[TestClass]
|
public class CSharpTest
|
{
|
/// <summary>
|
/// 测试 写入异常对象
|
/// </summary>
|
[TestMethod]
|
public void Test_RemoveList()
|
{
|
List<string> _list = new List<string>() {
|
"11","22","33"
|
};
|
|
_list.RemoveAll(x => x == "11");
|
|
Console.WriteLine(_list);
|
}
|
|
/// <summary>
|
/// 测试 写入异常对象
|
/// </summary>
|
[TestMethod]
|
public void Test_Contains()
|
{
|
List<int> _list = new List<int>() {
|
1,11,111
|
};
|
|
List<int> _list2 = new List<int>() {
|
1,11,111,1111,34,11111
|
};
|
var zz = _list2.Where(x => _list.Contains(x)).ToList();
|
|
Console.WriteLine(_list);
|
}
|
|
/// <summary>
|
/// 测试 其他方法的事情
|
/// 测试结果:其他方法能改变 for循环中的对象
|
/// </summary>
|
[TestMethod]
|
public void Test_OtherFunObject()
|
{
|
List<WareContainerType> _list = new List<WareContainerType>() {
|
new WareContainerType(){ ContainerCode="aaa", WareMaterialTypeCode="aaa" },
|
new WareContainerType(){ ContainerCode="bbb", WareMaterialTypeCode="bbb" },
|
new WareContainerType(){ ContainerCode="ccc", WareMaterialTypeCode="ccc" },
|
};
|
|
foreach (var item in _list)
|
{
|
OtherTest(item);
|
}
|
|
foreach (var item in _list)
|
{
|
var zz = item;
|
}
|
|
Console.WriteLine(_list);
|
}
|
|
|
private void OtherTest(WareContainerType wareContainerType)
|
{
|
wareContainerType.ContainerCode = wareContainerType.WareMaterialTypeCode = "zzz";
|
}
|
}
|
}
|