473,503 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Method Arguements from a Comma-Delimited Text File

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
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
2 1504
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

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

"JeffM" <Je***@devdex.com> wrote in message
news:#r**************@tk2msftngp13.phx.gbl...
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
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
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


*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2822
by: Andreas Neudecker | last post by:
Hello. I am relatively new to Python and I have a strange problem with some code. In a class the __call__ method gets parameters like this: class WhatsUp: __call__ ( self, var1,
18
7968
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
15
2943
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
8
1851
by: Dawn Minnis | last post by:
Hey guys If I have a program (see codeSnippet1) that I compile to be called test.o Then run it as test.o n n 2 3 4 I want the code to be able to strip out the two characters at the start...
4
3114
by: Mark | last post by:
hey, i'm trying to get the current windows user and the groups they are in. Intergrated windows auth on and annoymous access turned off on IIS. However when trying to compile the following code...
4
1298
by: Panos Laganakos | last post by:
I want a class method to take action depending on the type of the arguement passed to it. ie: getBook(id) # get the book by ID getBook(name) # get the book by name .... Other languages use...
4
4250
by: Yobbo | last post by:
Hi All My query is as follows: SELECT STRINGTEXT, TOKENID FROM WEBSTRINGS WHERE TOKENID IN (6,20,234,19,32,4,800,177) All I want is my resultset to come back in the order that I have...
3
1816
by: Gilles Ganault | last post by:
Hello I'd like to make sure there isn't an easier way to extract all the occurences found with re.finditer: ======================= req = urllib2.Request(url, None, headers) response =...
2
1801
by: Nike | last post by:
I have a small question w.r.t usage of default arguements in template.. I shall try to elaborate this with an example.. let's say I have some template function , where EntryType is the input for...
5
1654
by: mmmtacos | last post by:
Hey, I'm pretty new to Java and am having some trouble writing a put() method for one of my programs. The basic idea of it is to have a matrix, made by a multi-dimensional array, then to create the...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.