コード例 #1
0
        public void LoadStoredSubscriptors_ValidSubscriptors_AssertTrue()
        {
            _subscriptorPersister.Setup(p => p.GetSubscriptors(_identification)).Returns(new List<Subscriptor> { _subscriptor });
            _processor.Setup(p => p.Subscribe(_subscriptionKey, _subscriptor.Service, _outputGateway.Object));

            _subscriptorsRepository.Setup(r => r.Add(_subscriptor));

            using (var subscriptorsHelper = new SubscriptorsHelper(_subscriptorsRepository.Object, _subscriptorPersister.Object))
            {
                subscriptorsHelper.Controller = _controller.Object;
                subscriptorsHelper.LoadStoredSubscriptors(_identification);
            }

            _subscriptorPersister.VerifyAll();
            _processor.VerifyAll();
        }
コード例 #2
0
        public void AddSubscriptors_ValidSubscriptors_AssertTrue()
        {
            _subscriptorPersister.Setup(p => p.Add(_subscriptor));
            _processor.Setup(p => p.Subscribe(_subscriptionKey, _subscriptor.Service, _outputGateway.Object));

            _subscriptorsRepository.Setup(r => r.Add(_subscriptor));

            using (var subscriptorsHelper = new SubscriptorsHelper(_subscriptorsRepository.Object, _subscriptorPersister.Object))
            {
                subscriptorsHelper.Controller = _controller.Object;
                subscriptorsHelper.Add(_subscriptor);
            }

            _subscriptorPersister.VerifyAll();
            _processor.VerifyAll();
        }
コード例 #3
0
        public void RemoveSubscriptors_ValidSubscriptors_AssertTrue()
        {
            _subscriptorsRepository.Setup(r => r.Get(_subscriptor.Service)).Returns(_subscriptor);
            _subscriptorsRepository.Setup(r => r.Remove(_subscriptor));

            _processor.Setup(p => p.Unsubscribe(_subscriptionKey, _subscriptor.Service, _outputGateway.Object));
            _subscriptorPersister.Setup(p => p.Remove(_subscriptor.Service));

            _outputControlGateway.Setup(o => o.Dispose());
            _outputGateway.Setup(o => o.Dispose());

            using (var subscriptorsHelper = new SubscriptorsHelper(_subscriptorsRepository.Object, _subscriptorPersister.Object))
            {
                subscriptorsHelper.Controller = _controller.Object;
                subscriptorsHelper.Remove(_subscriptor.Service);
            }

            _subscriptorPersister.VerifyAll();
            _processor.VerifyAll();
        }