using nunit 2.6.4 & fakeiteasy 1.25.2 unit test c# code in visual studio 2013 community edition
the following test fragment executes expected
[test] public void test_whatisupwithstreamread() { stream fakestream = a.fake<stream>(); byte[] buffer = new byte[16]; int numbytesread = fakestream.read(buffer, 0, 16); assert.areequal(0, numbytesread); } however decorate fake callto/returns() or returnslazily() statement...
[test] public void test_whatisupwithstreamread() { stream fakestream = a.fake<stream>(); a.callto(() => fakestream.read(a<byte[]>.ignored, a<int>.ignored, a<int>.ignored)).returns(1); byte[] buffer = new byte[16]; int numbytesread = fakestream.read(buffer, 0, 16); assert.areequal(1, numbytesread); } fakestream.read() throws system.invalidoperationexception message:
"the number of values out , ref parameters specified not match number of out , ref parameters in call."
from within fakeiteasy.configuration.buildablecallrule.applyoutandrefparametersvalueproducer(iinterceptedfakeobjectcall fakeobjectcall), seems pretty odd me stream.read() doesn't have out/ref parameters.
is bug should reporting @ https://github.com/fakeiteasy, or missing something?
thx
update: bug has been fixed in fakeiteasy 1.25.3 , fakeiteasy 2.0.0.
yes, it's bug, appears have been introduced in 1.23.0. i've created issue 508. i'll work on fix in near future, , discuss other project owners in release want issue fix. head on over if have opinion.
in meantime, 1 possible workaround roll fakeiteasy 1.22.0, if don't require of enhancements , bug fixes have been added in subsequent releases.
if that's not option, perhaps consider abstracting away stream.read , faking abstraction. or come , i'd happy discuss other paths.
Comments
Post a Comment