我针对 .NET 实施了以下 FitNesse 测试。它使用“RowFixture”返回一个经过验证的对象。这一切正常。
我的问题是,如何将“输入”从 FIT 测试传递给数组?目前,这是内部硬编码的。
这是FIT测试:
!|ReturnObjectMultiDimension|
|Id |Name |
|1, 2, 3, 4 |a, b, c, d |
这是代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using fit;
using dbfit;
namespace DbFitProject
{
public class ReturnObjectMultiDimension : RowFixture
{
public override Type GetTargetClass()
{
return typeof(CustomerObject);
}
public override object[] Query()
{
CustomerObject[] array = new CustomerObject[1];
array[0] = new CustomerObject(new int[4] { 1, 2, 3, 4 }, new string[4] {"a","b","c","d" });
return array;
}
}
public class CustomerObject
{
public int[] Id;
public string[] Name;
public CustomerObject(int[] Id, string[] Name)
{
this.Id = Id;
this.Name = Name;
}
}
}
感谢帮助。