public void TestInvokeChaincode() { string txId = "txId", chaincodeName = "CHAINCODE_ID", channel = "CHAINCODE_CHANNEL"; ChaincodeStub stub = new ChaincodeStub(channel, txId, handler.Object, new List <ByteString>(), null); Response expectedResponse = new Response(Status.SUCCESS, "MESSAGE", "PAYLOAD".ToBytes()); handler.Setup(a => a.InvokeChaincodeAsync(channel, txId, chaincodeName, new List <byte[]>(), token)).ReturnsAsync(expectedResponse); Assert.AreEqual(stub.InvokeChaincode(chaincodeName, new List <byte[]>()), expectedResponse); handler.Setup(a => a.InvokeChaincodeAsync(It.Is <string>(b => b == channel), It.Is <string>(b => b == txId), It.Is <string>(b => b == chaincodeName + "/" + channel), It.IsAny <List <byte[]> >(), token)).ReturnsAsync(expectedResponse); Assert.AreEqual(stub.InvokeChaincode(chaincodeName, new List <byte[]>(), channel), expectedResponse); }