How to test C# void method using Microsoft Testing?

72 Views Asked by At

I have the following method in C#.

public void LoadFromDataSet(DataSet dataset)
{
      if (dataset == null)
         return;

      LoadDynamicForm(dataset);
      LoadDynamicFormFields(dataset);
}

I would like to unit test the first 2 lines using the Microsoft Uni testing framework. How should I go about it?

1

There are 1 best solutions below

0
Gal I. On

If LoadDynamicForm or LoadDynamicFormFields has object you can mock so you can see that the mock object function weren’t called, look for moq nugget for mor information