[Test] public void Test_ShouldReturnSuccess() { int a = 3; int b = 4; int result = a + b; Assert.That(result, Is.EqualTo(7)); TestResult testResult = TestResult.Success; Assert.That(testResult.IsSuccess); }
[TestFixture] public class MyTestSuite { [Test] public void Test1() { // test implementation } [Test] public void Test2() { // test implementation } } [Test] public void TestRunner_ShouldRunTestSuite() { TestSuite testSuite = new TestSuite(typeof(MyTestSuite)); TestResult result = testSuite.Run(new NullListener()); Assert.That(result.IsSuccess); Assert.That(result.ResultState == ResultState.Success); }This example shows how to use the TestResult Success class in a test run. The test runner runs a test suite that contains two test cases. If both test cases pass successfully, then the overall test suite is considered successful and the TestResult.Success class is used to represent that success. Package library: NUnit Framework.