I am trying to write a fake for MFMailComposeViewController
for testing so I made a protocol called MailComposeViewController
and a class FakeComposeViewController
that is conformed to this protocol. I also made MFMailComposeViewController
conform to this protocol as well.
So in my code when I call it I am saying of type MailComposeViewController
I want to have a replacement for MFMailComposeViewController.canSendMail()
. If I try to replace with my protocol using: MailComposeViewController.canSendMail()
I get the error Static member 'canSendMail' cannot be used on protocol metatype 'MailComposeViewController.Protocol'
which makes sense. but how would I go about writing around this so I could decide to pass in a FakeComposeViewController.canSendMail() true
response when testing and the real MFMailComposeViewController.canSendMail() when running?
Aucun commentaire:
Enregistrer un commentaire