0

How do i verify an init-call with Moq? I have the following property defined in an interface:

public string Text { init; }

I want to verify that init was called with a specific parameter. Is that possible?

4
  • Wouldn't it be the same way as if it was Set?
    – gunr2171
    Commented yesterday
  • 1
    Why would you need that when Moq is going to instantiate the object? Commented yesterday
  • @gunr2171 No, as i cannot assign a value in the VerifySet-call
    – Stevie
    Commented 22 hours ago
  • @IvanPetrov Good point, i need it inside of an blazor unit test, maybe i've overseen something
    – Stevie
    Commented 22 hours ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.