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.
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using Xunit;
|
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
|
using Xunit.Extensions;
|
|
|
|
|
using Xunit.Sdk;
|
|
|
|
|
|
|
|
|
|
using ConfigureStudy.Test;
|
|
|
|
|
|
|
|
|
|
namespace ConfigureStudy.Test
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试程序集设置 夹具
|
|
|
|
|
/// 在整个测试程序集的所有类共享
|
|
|
|
|
/// 生命周期为整个测试集一个测试周期
|
|
|
|
|
/// </summary>
|
|
|
|
|
[CollectionDefinition("FullFixture")]
|
|
|
|
|
public class FullFixtureSetup : //只在类上做接口标识
|
|
|
|
|
ICollectionFixture<ConfigFixture>,
|
|
|
|
|
ICollectionFixture<TestServerFixture>
|
|
|
|
|
{
|
|
|
|
|
//类内,不做任何代码实现。
|
|
|
|
|
//使用步骤:
|
|
|
|
|
// 1、创建测试夹具类:如本例的 ConfigFixture 和 TestServerFixture
|
|
|
|
|
// 2、标识测试夹具类:本类
|
|
|
|
|
// 3、测试类中使用:
|
|
|
|
|
// a 标注[Collection("名称与设置类CollectionDefinition特性设置的名字保持相同")]特性
|
|
|
|
|
// b 构造函数时,添加“测试夹具类的”参数,构造函数内把参数赋值给私有变量
|
|
|
|
|
// c 测试方法内使用
|
|
|
|
|
}
|
|
|
|
|
}
|