Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }