1

.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;
        }
    }
}

手伝ってくれてありがとう。

4

1 に答える 1