You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Linq ;
using Xunit ;
using LinqStudy ;
namespace LinqStudy.Test.LinqToObject
{
///<summary>
/// 串联操作
///<summary>
public class ConcatTest
{
///<summary>
/// Concat: 将两个序列合并成一个序列, 不去重。与Union不同。
///<summary>
public void Concat_Test ( )
{
List < Person > peoples1 = new List < Person > ( )
{
new Person ( ) { Id = 2 , Name = "小龙女" , Age = 28 } ,
new Person ( ) { Id = 4 , Name = "杨过" , Age = 32 } ,
} ;
List < Person > peoples2 = new List < Person > ( )
{
new Person ( ) { Id = 2 , Name = "小龙女" , Age = 28 } ,
new Person ( ) { Id = 3 , Name = "云花公主" , Age = 16 } ,
} ;
var concatAct = peoples1 . Concat ( peoples2 ) ;
var totalCount = concatAct . Count ( ) ;
Assert . Equal ( 4 , totalCount ) ;
}
}
}