我有以下测试夹具类,出于我以外的原因,NUnit 决定围绕这一类而不是这一类运行所有测试类
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
using MyProject;
using NUnit.Framework;
namespace MyProject.Test
{
[TestFixture]
public class MyProjectTests
{
private const string Description = "This is a test Description generated through UNIT Tests";
private ManualWorkflowSchedulerService scheduler;
private WorkflowRuntime workflowRuntime;
[SetUp]
public void Init()
{
// set up workflow scheduler and runtime
this.workflowRuntime = new WorkflowRuntime();
this.scheduler = new ManualWorkflowSchedulerService(true); // run synchronously
this.workflowRuntime.AddService(this.scheduler);
this.workflowRuntime.StartRuntime();
// create Test Case Sources
object[] insertScenarios =
{
new object[] { typeof(RaiseScenario), this.workflowRuntime, Description, true, true, string.Empty },
new object[] { typeof(RaiseScenario), this.workflowRuntime, Description, true, false, "New Reason" }
};
}
/// <summary>
/// The insert tests.
/// </summary>
/// <param name="runtime">
/// The runtime.
/// </param>
/// <param name="description">
/// The description.
/// </param>
/// <param name="outstandingWorkDocUploaded">
/// The Doc One Uploaded.
/// </param>
/// <param name="DocTwoUploaded">
/// The Doc Two Uploaded.
/// </param>
/// <param name="shortageReason">
/// The shortage Reason.
/// </param>
[Test, TestCaseSource("insertScenarios")]
public void TestInsert(
WorkflowRuntime runtime,
string description,
bool DocOneUploaded,
bool DocTwoUploaded,
string Reason)
{
var message = Business.InsertBoatHandoverOutsideCrew(runtime, description, DocOneUploaded, DocTwoUploaded, Reason);
Assert.AreNotEqual(0, message.Id);
}
}
}
测试项目的结构被分成它的组成部分,即解决方案的每个子项目在测试项目中都有自己的目录。这对于使用 .Net 3.5 编码的所有其他项目来说都不是问题,但该项目的测试现在被忽略了。