hi
I use nunit testing in my wpf project.here i want to call any class method in nunit test method.
i write the one registration method were All validation is done..so I want to call this registration method into nunit test method.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Thrish53 reputationPosted Mar 4, 2016, 12:54 AM EST
public int MyMethod(int a ,int b) { var res = a + b;Thrish53 reputationPosted Mar 3, 2016, 12:07 PM EST
Hi, If you have a class like below: public class MyClass { public int MyMethod() { } } Your TestClass should look something like below: [TestClass] public class MyClassTests { private MyClass _sample; [TestSetup] public void Initialize() { _sample = new MyClass(); } [Test] public void My_test() { //Act var result = _sample. MyMethod(); //Assert Assert.IsNotNull(result); } }Priya M36 reputationPosted Mar 3, 2016, 9:05 PM EST
Thrish53 reputationPosted Mar 4, 2016, 1:04 AM EST
Priya M36 reputationPosted Mar 4, 2016, 2:14 AM EST