I need to pull data from a ".ini" file for the test case to operate on. Which of the three: [InlineData]
, [ClassData]
or [MemberData]
attribute is best to use? I'm relatively new to C# programming, kindly bear with me. Thanks in advance!
Asked
Active
Viewed 103 times
0

Pac0
- 21,465
- 8
- 65
- 74
1 Answers
0
Since you need to execute some code to load your data, you can rule out InlineData
(this one is to write constant values directly above the test method).
You an use either ClassData
or MemberData
, really. Refer to the documentation on how to use them, and then ask another question if you have a more precise issue.
To read an ini file, you can refer to Reading/writing an INI file.
As a hint, you can get the full filepath when executing the test like this, if the ini file "myFile.ini" is at the root of your project : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "myFile.ini")
.
Also, don't forget to select a "Copy" property as action for your ini file, in the solution.

Pac0
- 21,465
- 8
- 65
- 74