public void ExpectSynchronizedDelegation(Action <T> action) { ArgumentUtility.CheckNotNull("action", action); _innerMock.BackToRecord(); _innerMock .Expect(action) .WhenCalled(mi => LockTestHelper.CheckLockIsHeld(_lockObject)); _innerMock.Replay(); action(_lockingDecorator); _innerMock.VerifyAllExpectations(); }
public void ExpectSynchronizedDelegation <TResult> (Func <T, TResult> expectAction, Func <T, TResult> action, TResult fakeResult, Action <TResult> resultChecker) { _innerMock.BackToRecord(); _innerMock .Expect(mock => expectAction(mock)) .Return(fakeResult) .WhenCalled(mi => LockTestHelper.CheckLockIsHeld(_lockObject)); _innerMock.Replay(); var actualResult = action(_lockingDecorator); _innerMock.VerifyAllExpectations(); resultChecker(actualResult); }