public void PerformActionExceptionDisconnect() { var remoteService = MockRepository.Mock <IService>(); remoteService.Stub(_ => _.MethodException()).Throws <ArgumentException>(); var disconnected = false; var ra = new RemoteAccess <IService>(() => remoteService, () => disconnected = true); Assert.Throws <ArgumentException>(() => ra.Perform(_ => _.MethodException())); Assert.IsTrue(disconnected); }
public void PerformFunction() { var remoteService = MockRepository.Mock <IService>(); remoteService.Stub(_ => _.Method2()).Repeat.Once().Return("from remote service"); var disconnected = false; var ra = new RemoteAccess <IService>(() => remoteService, () => disconnected = true); var result = ra.Perform(_ => _.Method2()); Assert.IsFalse(disconnected); Assert.AreEqual("from remote service", result); remoteService.VerifyAllExpectations(); }
public void PerformAction() { var remoteService = MockRepository.Mock <IService>(); remoteService.Stub(_ => _.Method()).Repeat.Once(); var disconnected = false; var ra = new RemoteAccess <IService>(() => remoteService, () => disconnected = true); ra.Perform(_ => _.Method()); Assert.IsFalse(disconnected); remoteService.VerifyAllExpectations(); }