I have a method public void SendMail(string email, string subject, string body, List<Attachment> attachements = null)
where last parameter can be null
or List<Attachment>
.
I mocked it like this:
var mailMock = new Mock<IMailService>();
mailMock.Setup(m => m.SendMail(It.IsNotNull<string>(), It.IsNotNull<string>(), It.IsNotNull<string>(), It.IsAny<List<Attachment>>())).Verifiable();
mailMock.Verify();
But it doesn't allow null
values in attachment parameter. How can I allow both null
and List<Attachment>
to be passed?
Aucun commentaire:
Enregistrer un commentaire