I have a layout created like this:
var mock = new Mock<IPacket>(MockBehavior.Strict); mock.Setup(p => p.GetBytes()).Returns(new byte[] { }).Verifiable();
Intellisense for the installation method says the following:
"Defines a mocked type setting for calling the void return method.
But the mocking method p.GetBytes () does not return void, it returns an array of bytes.
Alternatively, another installation method is defined as Setup <>, and I can create my layout, for example:
var mock = new Mock<IPacket>(MockBehavior.Strict); mock.Setup<byte[]>(p => p.GetBytes()).Returns(new byte[] { }).Verifiable();
The intellisense of this installation method states:
"Sets the mocked type to call the value return method.
.
.
Whatever method I choose, it compiles and checks OK. So, I am confused how I should do it. What is the difference between .Setup () and .Setup <> (), and am I doing it right?
Documents for Moka are a little lacking, let's say so. :)
source share