I have two unit tests that use TypeMock Isolator to isolate and fake a method from asp.net SqlMembershipProvider.
In test 1, I have:
Isolate.WhenCalled( () => Membership.CreateUser(...))) .WithExactArguments() .WillThrow(new Exception());
In test 2, I have:
Isolate.WhenCalled( () => Membership.CreateUser(...))) .WithExactArguments() .WillReturn(new MembershipUser(...));
When I run each test on its own, they both pass successfully.
When I run both tests, test number 1 starts first and passes and then tests number 2 and fails with the exception caused by test 1.
Why did the WillThrow() command in test 1 bleed for test 2? After all, test 2 explicitly defines a different behavior - WillReturn() ?
c # unit-testing typemock typemock-isolator
urig
source share