简体   繁体   中英

How to test C# void method using Microsoft Testing?

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?

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM