コード例 #1
0
 public void Init()
 {
     _browserApi     = Substitute.For <IBrowsersManagerApi, ICommunicationObject>();
     _serviceStarter = Substitute.For <IServiceBuilder <IBrowsersManagerApi> >();
     _serviceStarter.CreateServiceAndTryToConnect().Returns(_browserApi);
     _uiHelper                   = Substitute.For <IUiHelper>();
     _log                        = Substitute.For <ILogger>();
     _communicationObject        = (ICommunicationObject)_browserApi;
     _browserWindowsCommunicator = new BrowserWindowsCommunicator(_serviceStarter, _uiHelper, _log);
 }
コード例 #2
0
 public void Init()
 {
     _service        = Substitute.For <IBrowsersManagerApi, ICommunicationObject>();
     _serviceStarter = Substitute.For <IServiceBuilder <IBrowsersManagerApi> >();
     _serviceStarter.CreateServiceAndTryToConnect().Returns(_service);
     _uiHelper            = Substitute.For <IUiHelper>();
     _log                 = Substitute.For <ILogger>();
     _communicationObject = (ICommunicationObject)_service;
     _serviceClient       = new AbstractServiceClient <IBrowsersManagerApi>(_serviceStarter, _uiHelper, _log);
 }
コード例 #3
0
 public void Init()
 {
     _browserApi = Substitute.For<IBrowsersManagerApi, ICommunicationObject>();
     _serviceStarter = Substitute.For<IServiceBuilder<IBrowsersManagerApi>>();
     _serviceStarter.CreateServiceAndTryToConnect().Returns(_browserApi);
     _uiHelper = Substitute.For<IUiHelper>();
     _log = Substitute.For<ILogger>();
     _communicationObject = (ICommunicationObject)_browserApi;
     _browserWindowsCommunicator = new BrowserWindowsCommunicator(_serviceStarter, _uiHelper, _log);
 }
コード例 #4
0
 public void Init()
 {
     _service = Substitute.For<IBrowsersManagerApi, ICommunicationObject>();
     _serviceStarter = Substitute.For<IServiceBuilder<IBrowsersManagerApi>>();
     _serviceStarter.CreateServiceAndTryToConnect().Returns(_service);
     _uiHelper = Substitute.For<IUiHelper>();
     _log = Substitute.For<ILogger>();
     _communicationObject = (ICommunicationObject)_service;
     _serviceClient = new AbstractServiceClient<IBrowsersManagerApi>(_serviceStarter, _uiHelper, _log);
 }
コード例 #5
0
        public void Start()
        {
            _log.Info("Starting service " + typeof(T).FullName);
            _failedState = true;
            var service = _serviceStarter.CreateServiceAndTryToConnect();

            if (!(service is ICommunicationObject))
            {
                throw new InvalidOperationException("Service is not an instance of ICommunicationObject");
            }

            _communicationObject = (ICommunicationObject)service;

            _failedState = false;
            _log.Info("Service " + typeof(T).FullName + " was started.");
        }