1

How can I call one test case from another like:

[TestMethod] Public void GetRes() { var Result=ObjectClass.AddMaths(10,20); Assert.AreEqual(30, result); } 

But I would like to test more then one like the following:

public static IEnumerable TestCaseMethod1() { ArrayList ObjList = new ArrayList(); //How can I write a Test Case For GetRes() & how can I call TestCaseMethod1() } 

1 Answer 1

1

I think what you are referring to is data driven testing, which is essentially passing data to a unit test via an attribute on the test method. There are plenty of resources on this topic e.g https://msdn.microsoft.com/en-gb/library/ms182527.aspx

I prefer nUnit's methodology for this (as opposed to MSTest which you are using). I'd suggest doing a search for data driven tests with nUnit (http://gigi.nullneuron.net/gigilabs/data-driven-tests-with-nunit/ has a good example).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.