c# - How do you test methods that take enums -


I already have a test setup for this function, but I would like to know if most of the information about it Good way i have such a method:

  RunTableInfoCommand public static string (IMapinfoWrapper wrapper, TableInfoEnum infoToReturn) {// int value of infoToReturn for embedded COM objects eg. Covering TableInfoEnum looks like this (short version):  
  public enum TableInfoEnum {TAB_INFO_NAME = 1, TAB_INFO_NUM = 2, TAB_INFO_TYPE = 3, TAB_INFO_NCOLS = 4, TAB_INFO_MAPPABLE = 5, TAB_INFO_READONLY = 6, TAB_INFO_TEMP = 7}  

When I put enum into a COM object it will return different string results based on the enum value. E.g. The COM object will always return a different value based on the value only, depending on the value of the TAB_INFO_NAME = "Water_Mains" TAB_INFO_NUM = "1"

How do I test that my RunTableInfoCommand is working properly, so far I have such a test:

  Public Zero RunTableInfoCommandPassingTableNumberShouldReturnExpectedName () {string ExpectedCommand = "TableInfo (1, {0})" with ((TabletInfoEnum.TAB_INFO_NAME)). Mockmapinfo Expect (M => M. Evil (required commodity)). Returns ("Watermonds"); String name = Table.RenTableInformMand (Mockmapinfo.Object, 1, TablinFoine.TAB_INFO_NAME); Extraordinary ("Waterway", name); }  

This works but I feel as if I'm missing something, how do you test for all different types of eMan types.

If I understand you correctly, then your method under the value of the value in the COM object Must pass and return the string which is the COM object return, so the goal of the test is to ensure that the method is properly talking to the COM object.

I will mock the COM object to return the expected string for each enum value, then pass it to the method


Comments