I have the following FitNesse test implemented against .NET. It uses "RowFixture" to return an object which is verified. All this works ok.
My Question is, how can I pass the "inputs" to the array from the FIT test? At the monent, this is hard coded internally.
Here is the FIT test:
!|ReturnObjectMultiDimension|
|Id |Name |
|1, 2, 3, 4 |a, b, c, d |
Here is the code:
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;
}
}
}
Thanks for help.
It's simpler to just have a class that creates a customer object list and fitSharp will automatically wrap the list in a fixture to check the results:
public class MyClass {
public List<CustomerObject> MakeListWithIdsNames(int[] ids, string[] names) {
return new List<CustomerObject> { new CustomerObject(ids, names) };
}
}
|my class|
|make list with ids|1,2,3,4|names|a,b,c,d|
|id|name|
|1,2,3,4|a,b,c,d|
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.