Esempio n. 1
0
        public void SetUp()
        {
            _connectionListener    = MockRepository.GenerateMock <IServerConnectionListener>();
            _remoteExecutorFactory = MockRepository.GenerateMock <IRemoteExecutorFactory>();
            _taskScheduler         = MockRepository.GenerateMock <ITaskScheduler>();
            _config = MockRepository.GenerateMock <IServerConfig>();
            _config.Stub(c => c.MaxConnections).Return(10);
            _config.Stub(c => c.RemoteExecutorFactory).Return(_remoteExecutorFactory);
            _config.Stub(c => c.TaskScheduler).Return(_taskScheduler);
            _operationDispatcher = MockRepository.GenerateMock <IOperationDispatcher>();
            _operationDispatcher.Stub(d => d.MessageDispatcher).Return(MockRepository.GenerateMock <IMessageDispatcher>());
            _broadcastChannel = MockRepository.GenerateMock <IBroadcastChannel>();
            _connectionListener.Stub(l => l.BroadcastChannel).Return(_broadcastChannel);
            _broadcastExecutor = MockRepository.GenerateMock <IBroadcastRemoteExecutor>();
            _remoteExecutorFactory.Stub(f => f.CreateBroadcastRemoteExecutor(_broadcastChannel)).Return(_broadcastExecutor);

            _subject = new GenericServerEndpoint(_connectionListener, _config, () => _operationDispatcher);
        }
Esempio n. 2
0
 public void Should_is_running_reflect_listener_state(bool expected)
 {
     _connectionListener.Stub(l => l.IsListening).Return(expected);
     Assert.That(_subject.IsRunning, Is.EqualTo(expected));
 }