satmisha
asked on
How to test methos returns nothing in nUnit
Hi Team,
I have the following method which returns nothing and takes nothing, I need to write the test method using the NUnit framework in C#. How could I achieve that?
Nishant
I have the following method which returns nothing and takes nothing, I need to write the test method using the NUnit framework in C#. How could I achieve that?
Public Async Task ReceiveDataOnQueue()
{
Try
{
If(Dev)
{
cred = GenerateToken();
sqlClient = new AmazonSQlClient(cred, endPoint);
}
else{
sqlClient = new AmazonSQlClient(cred, endPoint)
}
ReadMessageFromQueue(sqlClient);
DeleteMessageFromQueue();
}
Catch(Exception Ex)
{
Throw Ex
}
}
Nishant
ASKER
Thank you ste5an for your prompt reply.
I am totally novice to testing got stuck on this. What I need to write is a nUnit test case for the above-said method, there any many more but if I get the help on one probably I can start writing others.
Appreciate it if you could help me out with some link through which I can start with it.
I am totally novice to testing got stuck on this. What I need to write is a nUnit test case for the above-said method, there any many more but if I get the help on one probably I can start writing others.
Appreciate it if you could help me out with some link through which I can start with it.
ASKER
experts pls help...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you, ste5an.
Maybe you rephrase your question and explain what you like test for what reason.
Also your method contains some smells, I would even say anti-patterns. You should view The Clean Code Talks - "Global State and Singletons" and "The Clean Code Talks -- Unit Testing".