[英]How do I Moq It.IsAny for an array in the setup of a method?
I'm brand new to Moq (using v 4) and am struggling a little with the documentation. 我是Moq的新手(使用第4版)并且在文档上有点挣扎。
What I'm trying to do is to Moq a method that takes a byte array and returns an object. 我正在尝试做的是Moq一个采用字节数组并返回一个对象的方法。 Something like:
就像是:
decoderMock.Setup(d => d.Decode(????).Returns(() => tagMock.Object);
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.
是byte []的位置,但是我无法弄清楚如何制作它以便我不关心字节数组中的内容,只返回我已经设置的模拟对象。
Moq.It.IsAny expects a generic. Moq.It.IsAny期望通用。
Any help please? 有什么帮助吗?
It.IsAny<byte[]>()
??
mock.Setup(m => m.GetFirstTicketInQueueIfMatches(It.IsAny<string[]>()))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.