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.
xUnitStudy/xUnitStudy.Model/xUnitStudy/CollectionFixtureDemo.cs

39 lines
930 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace xUnitStudy.Model
{
/// <summary>
/// 测试方法共享对象实例
/// </summary>
public class CollectionFixtureDemo : IDisposable
{
public List<Person> Persons;
public CollectionFixtureDemo()
{
Persons = new List<Person>()
{
new Person(){ Id=1, FirstName="first1",LastName="last1" },
new Person(){ Id=2, FirstName="first2",LastName="last2" },
new Person(){ Id=3, FirstName="first3",LastName="last3" },
};
}
public Person GetPersonById(int personId)
{
var find = Persons.FirstOrDefault(p => p.Id == personId);
return find;
}
public void Dispose()
{
Persons = null;
}
}
}