0

Below is my test case,

Public static void SampleTest() 
{
    // Pre conditions for both assert 1 and 2
    if(condition1)
    {
        // Assert 1
    }
    // Pre condition for Assert 2
    // Assert 2
}

Once condition1 satisfied and assert 1 executes I don't want to execute the further statements in above test case. On the other hand, if condition1 fails it should execute precondition for assert 2 and should publish the result based on assert 2

Thanks in advance.

UvarajGopu
  • 27
  • 9

1 Answers1

1

You can simply call return; after Assert 1:

Public static void SampleTest() 
{
    // Pre conditions for both assert 1 and 2
    if(condition1)
    {
        // Assert 1
        return;
    }
    // Pre condition for Assert 2
    // Assert 2
}
hunch_hunch
  • 2,283
  • 1
  • 21
  • 26
  • Thanks for you answer. Am searching for a option from NUNIT framework. Please consider the above use case has some post condition which is to be executed for both assert. Retun statement won't help me in such case. – UvarajGopu Sep 09 '14 at 05:42