dimanche 31 juillet 2016

unit test for ensuring a method inside a method is not called

I have two methods like below.

public bool IsSuccess()
{
   // Some logi
}

public bool ShouldSendLogic()
{
  var status = IsSuccess();
  if(status)
  {
    SendInvoice();
   // do some operation
  }
 return status;
}

Now I am writing integration/unit tests. I can call the ShouldSendLogic but I want to ensure SendInvoice is not called by setting the Success as false. (Just for negative case). How to write test case for this scenario, please help me with a code for this.

Aucun commentaire:

Enregistrer un commentaire