Desi Gal

Desi Gal

  • NA
  • 35
  • 0

how to create a mock dataset and unit test for void method.

May 4 2011 5:40 PM

I have a method whose return type is void. This method has two parameters, a strongly typed datarow and dataset.

private void Check(Dataset testDB, DataRow testRow)
{

        if(testRow.Amount>10)
        {
                decimal rate = testRow.Rate;

                if(rate >= 100)
                {
                        AddData(testDB,testRow,"some text");
                }

        }

}

private void AddData(Dataset testDB, DataRow testRow, string notes)
{
Dataset.StudentRow newRow=testDB.Students.NewStudentRow();
.
.
.
testDB.Students.AddStudentRow(newRow);
}



Answers (1)