How to mock methods which take or return a Span<T>

Viewed 480

We have been using moq which relies heavily on expression trees and reflection.emit. But Span is not allowed to be in an expression tree, so methods which take or return a Span cannot be mocked with it.

We have been working around this by manually creating the Mocks by implementing the interfaces ourselves. But it's time consuming and far from ideal.

How can I mock a method that takes or returns a Span?

0 Answers
Related