Getting Method Arguements from a Comma-Delimited Text File

  • Thread starter Thread starter JeffM
  • Start date Start date
J

JeffM

Hello all-
I'm pretty new here (and to C#) and am hoping you can help.
The title pretty much says it all...

I am doing some API testing would like to be able to pick up the
arguemnts for my method calls from a text file instead of putting them
in the code.

Here is an example of what I'm trying to do:

public void myMethod(int i, int j, string s)
{...}

I would like to send the arguemnts from a text file, where each line is
a call to the method.

EG. The text file looks something like:
12, 15, joe
07, 64, fred
etc.

Any suggestions or sample code hugely appreciated.
Thanks in advance,

Jeff
 
You can write a TextReader, read each line from the file and call the method
from your test program. I assume your method is in a test DLL and you'll
have to write a client to test the DLL

- Shuvro
 
Thanks for the reply,
I should have mentioned that I am also using NUnit to monitor output,
but don't like having to compile all of my inputs into the code and
recompile every time I have a new data set. So a text file for inputs
would be much nicer.

Can you make any suggestions for setting up the text reader. I am new to
C# so any details much appreciated.
Thanks,

Jeff
 
Back
Top