开发者

How do I Moq It.IsAny for an array in the setup of a method?

开发者 https://www.devze.com 2022-12-24 11:34 出处:网络
I\'m brand new to Moq (using v 4) and am struggling a little with the documentation. What I\'m trying to do is to Moq a method that takes a byte array and returns an object. Something like:

I'm brand new to Moq (using v 4) and am struggling a little with the documentation.

What I'm trying to do is to Moq a method that takes a byte array and returns an object. Something like:

decoderMock.Setup(d => d.Decode(????).Returns(() => tagMock.Objec开发者_StackOverflowt);

The ???? is where the byte[] should be, but I can't work out how to make it so that I don't care what's in the byte array, just return the mocked object I've already set up.

Moq.It.IsAny expects a generic.

Any help please?


It.IsAny<byte[]>()

??


Setup Method With Params Array

mock.Setup(m => m.GetFirstTicketInQueueIfMatches(It.IsAny<string[]>()))
0

精彩评论

暂无评论...
验证码 换一张
取 消