Hi,

I am working on a component based application. I have a method that does some calculation and returns nothing.

say:

public void DoSomething(int x, int y)
{
// do something
}

How to write testing for it.
I can pass some dummy x,y values. But how and what we can Assert in the unit test project.

Any help would be appreciated.

Thanks.
Regards

Does the method change anything external to the method?
If so, you can see if that changed or that it does not throw an exception...

In addition to what thines said above, if the DoSomething method acts on an object you could mock out the object and see if a particular method was called with a given set of parameters

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.