Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace SampleTestsProject
- {
- public class IfElseDetectExample
- {
- public void MethodWithIfBlock1(bool p1)
- {
- // detect this.
- if (p1)
- {
- // do stuff.
- // need to cover this block
- // in the test 'Act' part, need to call MethodWithIfBlock1 with parameters to make the condition of the if block to pass
- }
- else
- {
- // else part
- }
- }
- public void MethodWithIfBlock2(int p1)
- {
- // detect this.
- if (p1 > 0)
- {
- // do stuff.
- // need to cover this block
- // in the test 'Act' part, need to call MethodWithIfBlock2 with parameters to make the condition of the if block to pass
- }
- else
- {
- // else part
- }
- }
- public void MethodWithIfBlock3(string p1, int p2)
- {
- // detect this.
- if (p1 == "a" && p2 == 0)
- {
- // do stuff.
- // need to cover this block
- // inside the test, need to call MethodWithIfBlock3 with parameters to make the condition of the if block to pass
- }
- else
- {
- // else part
- }
- }
- public void MethodWithIfBlock4(int p1, int p2)
- {
- // detect this.
- if (p1 > p2)
- {
- // do stuff.
- // need to cover this block
- // inside the test, need to call MethodWithIfBlock4 with parameters to make the condition of the if block to pass
- }
- else
- {
- // else part
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement