c# - ToArray doesn't seem to be working Moq's Verify method -
i'm trying verify method call using moq following code.
var _payload= new list<keyvaluepair<string, object>> { new keyvaluepair<string, object>("test", testnum), new keyvaluepair<string, object>("firstruntime", datetime.parse("19-apr-2001 09:30:00")) };
the above list definition common both following pieces of code. i'd tried this::
mockmessageprocessor.verify(service => service.queuemessage( datetime.parse("19-apr-2016 10:05:00"), "testjobkey", _payload.toarray()), times.once);
this fails saying there no invocation of above method parameters. putting same thing in variable works.
var payloadarray = _payload.toarray(); mockmessageprocessor.verify(service => service.queuemessage( datetime.parse("19-apr-2016 10:05:00"), "testjobkey", payloadarray), times.once);
the above verify works. wanted know why happening.
quoting aron comment above:
because equals(_payload.toarray(), _payload.toarray() == false
whilst equals(payloadarray, payloadarray) == true
Comments
Post a Comment