Friday, June 30, 2006

RowFixture Example in C# -- Fit


EmployeePayRecordsRowFixture.cs
using System;


public class EmployeePayRecordsRowFixture : fit.RowFixture
{
public override Object[] Query()
{

EmployeePayRecord[] records = new EmployeePayRecord[2];
records[0] = new EmployeePayRecord(1, 1000);
records[1] = new EmployeePayRecord(2,2000);
return records;
}

public override System.Type GetTargetClass()
{
return typeof(EmployeePayRecord);
}
}


EmployeePayRecord.Cs
using System;
public class EmployeePayRecord
{
public int id;
private double salary;
public EmployeePayRecord(int id, double salary)
{
this.id = id;
this.salary = salary;
}
public double pay()
{
return salary;
}
}

2 comments:

survic said...

I submitted some comments a few days ago; I guess it got lost.
I want to learn the feedback of your using FIT.

I have my doubts. It definitely introduces more complexity, and what you gain? Why ordinary unit testing is not sufficient?

I can see the value of a web interface. However, as you've mentioned also, “power users” cannot really use it directly. Perhaps it is good for “business analysts”? – that makes a lot of sense; however, I am still question whether it is worth it.

Vikas said...

Hi Survice,

Read my post
FAQ

Given the nature of my project i.e, Business Intelligence Tool, I can exploit Fit tables only in limited ways.
Otherwise possibilities are endless.