I'm using Moq in my code. I wrote an expression like:
mockInvoice.VerifySet(x => x.InvoiceAttachmentId, Times.Once());
Where InvoiceAttachmentId
is a property on my Invoice.
It works fine but I get the warning:
Moq.MockExtensions.VerifySet(Moq.Mock, System.Linq.Expressions.Expression>, Moq.Times)' is obsolete: 'Replaced by VerifySet(Action, Times)'
Can anyone tell me how to rewrite it to satisfy the compiler and get rid of the warning? I'm unsure how to make the replacement to Action.
mockInvoice.VerifySet(x => x.InvoiceAttachmentId = 123, Times.Once());
Replace 123 with the expected value.
If you want to permit any value, use:
mockInvoice.VerifySet(x => x.InvoiceAttachmentId = It.IsAny<int>(),
Times.Once());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With