Advertisement
kpapakonstantinou

Untitled

Jan 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. namespace SampleTestsProject
  2. {
  3.     public class IfElseDetectExample
  4.     {
  5.         public void MethodWithIfBlock1(bool p1)
  6.         {
  7.             // detect this.
  8.             if (p1)
  9.             {
  10.                 // do stuff.
  11.                 // need to cover this block
  12.                 // in the test 'Act' part, need to call MethodWithIfBlock1 with parameters to make the condition of the if block to pass
  13.             }
  14.             else
  15.             {
  16.                 // else part
  17.             }
  18.         }
  19.  
  20.         public void MethodWithIfBlock2(int p1)
  21.         {
  22.             // detect this.
  23.             if (p1 > 0)
  24.             {
  25.                 // do stuff.
  26.                 // need to cover this block
  27.                 // in the test 'Act' part, need to call MethodWithIfBlock2 with parameters to make the condition of the if block to pass
  28.             }
  29.             else
  30.             {
  31.                 // else part
  32.             }
  33.         }
  34.  
  35.         public void MethodWithIfBlock3(string p1, int p2)
  36.         {
  37.             // detect this.
  38.             if (p1 == "a" && p2 == 0)
  39.             {
  40.                 // do stuff.
  41.                 // need to cover this block
  42.                 // inside the test, need to call MethodWithIfBlock3 with parameters to make the condition of the if block to pass
  43.             }
  44.             else
  45.             {
  46.                 // else part
  47.             }
  48.         }
  49.  
  50.         public void MethodWithIfBlock4(int p1, int p2)
  51.         {
  52.             // detect this.
  53.             if (p1 > p2)
  54.             {
  55.                 // do stuff.
  56.                 // need to cover this block
  57.                 // inside the test, need to call MethodWithIfBlock4 with parameters to make the condition of the if block to pass
  58.             }
  59.             else
  60.             {
  61.                 // else part
  62.             }
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement