예제 #1
0
        private void GivenMockTransportService()
        {
            var mockTransportService = new Mock <ITransportService>();

            mockTransportService.Setup(x => x.SendMessage(
                                           It.IsAny <Message>(),
                                           It.IsAny <IEndpointCredentials>(),
                                           It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            mockTransportService.Setup(x => x.PublishMessage(
                                           It.IsAny <Message>(),
                                           It.IsAny <TopicName>(),
                                           It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            mockTransportService.Setup(x => x.Subscribe(
                                           It.IsAny <IEndpoint>(),
                                           It.IsAny <TopicName>(),
                                           It.IsAny <TimeSpan>(),
                                           It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            TransportService = mockTransportService.Object;
        }
예제 #2
0
        public StationTimeTableViewModel(ITransportService transportService)
        {
            this.transportService = transportService;

            this.StationBoard            = new ObservableCollection <string>();
            this.LoadStationBoardCommand = new RelayCommand <string>(this.ExecuteSearch, this.CanExecuteSearch);
        }
        private void InitializeServiceAsync(System.Action callback)
        {
            Debug.WriteLine("[CallInProgressAgentImpl {0}] _mtProtoService == null {1}", GetHashCode(), _mtProtoService == null);

            if (MTProtoService == null)
            {
                var deviceInfoService = new Telegram.Api.Services.DeviceInfo.DeviceInfoService(GetInitConnection(), true, "BackgroundDifferenceLoader", 1);
                var cacheService      = new MockupCacheService();
                var updatesService    = new MockupUpdatesService();

                _transportService = new TransportService();
                var connectionService   = new ConnectionService(deviceInfoService);
                var publicConfigService = new MockupPublicConfigService();

                var mtProtoService = new MTProtoService(deviceInfoService, updatesService, cacheService, _transportService, connectionService, publicConfigService);
                mtProtoService.Initialized += (o, e) =>
                {
                    //Log(string.Format("[MTProtoUpdater {0}] Initialized", GetHashCode()));
                    Thread.Sleep(1000);
                    callback.SafeInvoke();
                };
                mtProtoService.InitializationFailed += (o, e) =>
                {
                    //Log(string.Format("[MTProtoUpdater {0}] InitializationFailed", GetHashCode()));
                };
                mtProtoService.Initialize();

                MTProtoService = mtProtoService;
            }
            else
            {
                callback.SafeInvoke();
            }
        }
        public ServerResponseService()
        {
            _transcriptionModel = new TranscriptionModel();

            _transportService = Mvx.IoCProvider.Resolve <ITransportService>();
            _transportService.NewDataRecieved += ProcessServerResponse;
        }
예제 #5
0
 public TransportController(ITransportService service, ApplicationDbContext context,
                            UserManager <User> userManager)
 {
     _service     = service;
     _context     = context;
     _userManager = userManager;
 }
예제 #6
0
        public TimeTableViewModel(ITransportService transportService)
        {
            this.TimeTableSearch = new TimeTableSearchViewModel(transportService);
            this.FoundConnections = new ConnectionsViewModel();

            this.TimeTableSearch.NewSearchConnectionResult += (sender, args) => this.FoundConnections.UpdateConnections(args.ConnectionsResult);
        }
예제 #7
0
        public TransportViewModel()
        {
            _transportService = new TransportService(_unitOfWork);
            _transportMapper  = new TransportMapper();

            modelObjects = _transportService.GetAllTransports().Select(transport => _transportMapper.FromDomainToModel(transport)).ToList();
        }
예제 #8
0
        public ProxyListViewModel(IProxyChecker proxyChecker, ITransportService transportService, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            SuppressSharing = StateService.SuppressProxySharing;
            StateService.SuppressProxySharing = false;

            _proxyChecker     = proxyChecker;
            _transportService = transportService;

            PropertyChanged += (sender, args) =>
            {
                if (Property.NameEquals(args.PropertyName, () => IsEnabled))
                {
                    var proxy = _proxyConfig.GetProxy();
                    _proxyConfig.IsEnabled = new TLBool(IsEnabled);
                    if (proxy != null)
                    {
                        proxy.NotifyOfPropertyChange(() => proxy.Self);
                    }
                    SetReconnect(!_proxyConfig.IsEmpty, _proxyConfig, null);
                }
                else if (Property.NameEquals(args.PropertyName, () => UseForCalls))
                {
                    var proxy = _proxyConfig.GetProxy();
                    _proxyConfig.UseForCalls = new TLBool(UseForCalls);
                    if (proxy != null)
                    {
                        proxy.NotifyOfPropertyChange(() => proxy.Self);
                    }
                    SetReconnect(false, _proxyConfig, null);
                }
            };
        }
예제 #9
0
        public ProxyViewModel(ITransportService transportService, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            SuppressSharing = StateService.SuppressProxySharing;
            StateService.SuppressProxySharing = false;

            _transportService = transportService;

            _proxy             = StateService.Proxy;
            StateService.Proxy = null;

            if (_proxy != null)
            {
                Server = _proxy.Server.ToString();
                Port   = _proxy.Port.Value >= 0 ? _proxy.Port.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;

                var socks5Proxy = _proxy as TLSocks5Proxy;
                if (socks5Proxy != null)
                {
                    Username       = socks5Proxy.Username.ToString();
                    Password       = socks5Proxy.Password.ToString();
                    _isSocks5Proxy = true;
                }

                var mtProtoProxy = _proxy as TLMTProtoProxy;
                if (mtProtoProxy != null)
                {
                    Secret         = mtProtoProxy.Secret.ToString();
                    _isSocks5Proxy = false;
                }
            }
        }
예제 #10
0
        public SearchStationViewModel(ITransportService transportService)
        {
            this.InitializeSearchStationCommand(transportService);
            this.Stations = new ObservableCollection<Station>();

            this.stationPosition = LocationBern;
        }
        public TimeTableViewModel(ITransportService transportService)
        {
            this.TimeTableSearch  = new TimeTableSearchViewModel(transportService);
            this.FoundConnections = new ConnectionsViewModel();

            this.TimeTableSearch.NewSearchConnectionResult += (sender, args) => this.FoundConnections.UpdateConnections(args.ConnectionsResult);
        }
        public StationTimeTableViewModel(ITransportService transportService)
        {
            this.transportService = transportService;

            this.StationBoard = new ObservableCollection<string>();
            this.LoadStationBoardCommand = new RelayCommand<string>(this.ExecuteSearch, this.CanExecuteSearch);
        }
 public BackgroundWorkerArgs(ITransportService transportService, DateTime startTime, string from, string to)
 {
     this.TransportService = transportService;
     this.StartTime        = startTime;
     this.From             = @from;
     this.To = to;
 }
예제 #14
0
 public EventsController(ITransportService transportService, IEventsService eventsService, UserManager <ApplicationUser> userManager, IChatService chatService)
 {
     this.transportService = transportService;
     this.eventsService    = eventsService;
     this.userManager      = userManager;
     this.chatService      = chatService;
 }
예제 #15
0
        public SearchStationViewModel(ITransportService transportService)
        {
            this.InitializeSearchStationCommand(transportService);
            this.Stations = new ObservableCollection <Station>();

            this.stationPosition = LocationBern;
        }
예제 #16
0
        //public HomeController() { }

        public HomeController(IOfficeLocationService officeLocationService, ITransportService transportService, IArticleService articleService) 
        {
            _transportService = transportService;
            _officeLocationService = officeLocationService;
            _articleService = articleService;

            //Enforce.NotNull(() => officeLocationService);
        }
예제 #17
0
 /// <summary>
 /// Creates a new MainViewModel.
 /// </summary>
 public MainViewModel(ITransportService transportService, IPluginSettings settings,
                      INavigationService navigationService, ILocationService locationService)
 {
     _transportService  = transportService;
     Settings           = settings;
     _navigationService = navigationService;
     _locationService   = locationService;
 }
예제 #18
0
        public MaintenanzController(IArticleService articleService, ITransportService transportService) 
        {
            _transportService = transportService;
            _articleService = articleService;
            //_officeLocationService = officeLocationService;

            //Enforce.NotNull(() => officeLocationService);
        }
예제 #19
0
        public SaveLogPresenter(IKernel kernel, ISaveLogView view, ITransportService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _view.Save     += Save;
            _view.ViewLoad += ViewLoad;
        }
예제 #20
0
        public SetUpRoadPresenter(IKernel kernel, ISetUpRoadView view, ITransportService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _view.Apply         += Apply;
            _view.SetUpRoadLoad += SetUpRoadLoad;
        }
예제 #21
0
        public AddMuscleVehiclePresenter(IKernel kernel, IAddMuscleVehicleView view, ITransportService transportService, IVerificationDataForMuscleVehicleService vrifiactionService)
        {
            _kernel             = kernel;
            _transportService   = transportService;
            _verificatinService = vrifiactionService;
            _view = view;

            _view.AddVehicle += AddVehicle;
        }
예제 #22
0
        private void InitializeSearchStationCommand(ITransportService transportService)
        {
            var searchStationCommand = new SearchStationAsyncCommand(transportService);

            searchStationCommand.StationSearchCompleted += this.StationSearchCompletedHandler;
            searchStationCommand.BeginStationSearch     += this.BeginStationSearchHandler;

            this.SearchStationCommand = searchStationCommand;
        }
        public void Execute(DoWorkEventArgs ea)
        {
            var args = (BackgroundWorkerArgs)ea.Argument;

            ITransportService service = args.TransportService;

            IEnumerable <Station> locations = service.GetLocations(args.StationQuery);

            ea.Result = locations;
        }
예제 #24
0
        public TravelReviewService()
        {
            IRepository <TravelReview> repository = RepositoryFactory.GetRepository <TravelReview>();

            this._saveRepository = repository;
            this._getRepository  = repository;

            this._transportService     = new TransportService();
            this._travelFeelingService = new TravelFeelingService();
        }
예제 #25
0
        private void RunSearch(DoWorkEventArgs ea)
        {
            var args = (BackgroundWorkerArgs)ea.Argument;

            ITransportService service = args.TransportService;

            IEnumerable <Stationboard> stationboard = service.GetStationBoard(args.Station);

            ea.Result = stationboard;
        }
예제 #26
0
        public TransportController(IServiceProvider serviceProvider, IOptions <MyConfig> config, IHostingEnvironment hostingEnvironment)
        {
            this._hostingEnvironment = hostingEnvironment;

            this.config = config;

            _TransportService = serviceProvider.GetService <ITransportService>();
            _identityService  = serviceProvider.GetService <IIdentityService>();
            _validateService  = serviceProvider.GetService <IValidateService>();
        }
예제 #27
0
        /// <summary>
        /// Creates a new AddStationViewModel.
        /// </summary>
        public AddStationViewModel(ITransportService transportService, ILocationService locationService,
                                   INavigationService navigationService, IPluginSettings pluginSettings)
        {
            _transportService  = transportService;
            _locationService   = locationService;
            _navigationService = navigationService;
            _pluginSettings    = pluginSettings;

            this.ListenToProperty(x => x.Query, OnQueryChanged);
        }
예제 #28
0
        public TransportActor(ITransportService service)
        {
            _service = service;

            ReceiveAsync <GoodsData>(async msg =>
            {
                var result = await _service.GetTransportInfoAsync(msg);
                Sender.Tell(result);
            });
        }
예제 #29
0
 public CardController(ICardService cardService,
                       ICardTypeService cardTypeService,
                       IDiscountCardDetailsService discountCardDetailsService,
                       ITransportService transportService)
 {
     _cardService                = cardService;
     _cardTypeService            = cardTypeService;
     _discountCardDetailsService = discountCardDetailsService;
     _transportService           = transportService;
 }
        public void Execute(DoWorkEventArgs ea)
        {
            var args = (BackgroundWorkerArgs)ea.Argument;

            ITransportService service = args.TransportService;

            IEnumerable <Connection> connections = service.GetConnections(args.From, args.To, args.StartTime);

            ea.Result = connections;
        }
예제 #31
0
        public AddElectricVehicleTypeSelectionPresenter(IKernel kernel, IAddElectricVehicleTypeSelectionView view, ITransportService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _view.TramTypeSelected         += TramTypeSelected;
            _view.TroleyBusTypeSelected    += TroleyBusTypeSelected;
            _view.GoBackToSetUpVehicleView += GoBackToSetUpVehicleView;
            _view.Home += GoHome;
        }
예제 #32
0
        public AddMotorVehiclePresenter(IKernel kernel, IAddMotorVehicleView view, ITransportService transportService, IFuelService fuelService, IVerificationDataForMotorVehicleService vrifiactionService)
        {
            _kernel             = kernel;
            _transportService   = transportService;
            _fuelService        = fuelService;
            _verificatinService = vrifiactionService;
            _view = view;

            _view.AddVehicle += AddVehicle;
            _view.AddMotorVehicleViewLoad += AddMotorVehicleViewLoad;
        }
예제 #33
0
        //Methods/////////////////////////////
        public AddMotorVehicleTypeSelectionPresenter(IKernel kernel, IAddMotorVehicleTypeSelectionView view, ITransportService service)
        {
            _kernel  = kernel;
            _service = service;
            _view    = view;

            _view.CarTypeSelected          += CarTypeSelected;
            _view.TrukTypeSelected         += TrukTypeSelected;
            _view.PanzerTypeSelected       += PanzerTypeSelected;
            _view.GoBackToSetUpVehicleView += GoBackToSetUpVehicleView;
            _view.Home += GoHome;
        }
예제 #34
0
 public OutboundQueueListener(ITransportService transportService,
     IMessageJournalingService messageJournalingService, Func<Uri, IEndpointCredentials> credentialsFactory)
 {
     if (transportService == null)
     {
         throw new ArgumentNullException("transportService");
     }
     _transportService = transportService;
     _messageJournalingService = messageJournalingService;
     _credentialsFactory = credentialsFactory ??
                           (uri => null);
 }
예제 #35
0
 public TransportController(ITransportService transportService,
                            IFabrikaService fabrikaService,
                            IDepoService depoService,
                            ITransportMaliyetService transportMaliyetService,
                            ITransportSonucService transportSonucService)
 {
     _transportService        = transportService;
     _fabrikaService          = fabrikaService;
     _depoService             = depoService;
     _transportMaliyetService = transportMaliyetService;
     _transportSonucService   = transportSonucService;
 }
예제 #36
0
        public SetUpPresenter(IKernel kernel, ISetUpView view, ITransportService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _view.SetUpVehicles         += SetUpVehicles;
            _view.SetUpRoad             += SetUpRoad;
            _view.GoBackToTransportView += GoBackToTransportView;
            _view.Home          += GoBackToTransportView;
            _view.AddFuelInList += AddFuelInList;
        }
        private void InitializeSearchConnectionCommand(ITransportService transportService)
        {
            var searchConnectionsCommand = new SearchConnectionAsyncCommand(transportService);
            searchConnectionsCommand.BeginStationSearch += (sender, args) => this.IsBusy = true;
            searchConnectionsCommand.SearchConnectionCompleted += (sender, args) =>
            {
                this.NewSearchConnectionResult(sender, args);
                this.IsBusy = false;
            };

            this.SearchConnectionsCommand = searchConnectionsCommand;
        }
예제 #38
0
        public MonitoringApp(string host, string machineName)
        {
            _monitoringServices = new List<IMonitoringService>
            {
                new CpuMonitoringService(),
                new MemoryMonitoringService(),
                new DiskMonitoringService(),
                new NetworkMonitoringService()
            };

            _idService = new MacAddressIdService();
            _transportService = new HttpTransportService(host);
            _outputService = new ConsoleOutputService();
            _cpuNameService = new WMICpuNameService();

            InitServerInfo(machineName);
        }
예제 #39
0
        public void GivenIHaveTheFollowingTransportsInTheSystem(Table table)
        {
            transports = new List<TransportModel>();
            transports.AddRange(FillTransportModel(table));

            //Arrange
            mockTransportRepository = new Mock<ITransportRepository>();
            transportService = new TransportService(mockTransportRepository.Object);

            mockTransportRepository.Setup(r => r.FindAllExcept(TransportState.RETIRED))
                                   .Returns(transports.AsQueryable().Where(t => t.State != TransportState.RETIRED).AsQueryable());

            mockTransportRepository.Setup(r => r.FindBy(It.IsAny<Guid>()))
                                   .Returns(transports.First(t => t.State != TransportState.RETIRED));

            mockTransportRepository.Setup(r => r.Save(It.IsAny<TransportModel>()))
                                   .Returns(SavedTransportId);

            Assert.IsNotEmpty(transports, "Transports are empty!");
        }
예제 #40
0
파일: Bus.cs 프로젝트: tdbrian/Platibus
        /// <summary>
        /// Initializes a new <see cref="Bus"/> with the specified configuration and services
        /// provided by the host
        /// </summary>
        /// <param name="configuration">The core bus configuration</param>
        /// <param name="baseUri">The base URI provided by the host</param>
        /// <param name="transportService">The transport service provided by the host</param>
        /// <param name="messageQueueingService">The message queueing service provided by the host</param>
        /// <exception cref="ArgumentNullException">Thrown if any of the parameters are <c>null</c></exception>
        public Bus(IPlatibusConfiguration configuration, Uri baseUri, ITransportService transportService, IMessageQueueingService messageQueueingService)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");
            if (baseUri == null) throw new ArgumentNullException("baseUri");
            if (transportService == null) throw new ArgumentNullException("transportService");
            if (messageQueueingService == null) throw new ArgumentNullException("messageQueueingService");

            _baseUri = baseUri;
            _transportService = transportService;
            _messageQueueingService = messageQueueingService;

            // TODO: Throw configuration exception if message queueing service, message naming
            // service, or serialization service are null

            _messageJournalingService = configuration.MessageJournalingService;
            _messageNamingService = configuration.MessageNamingService;
            _serializationService = configuration.SerializationService;

            _endpoints = new ReadOnlyEndpointCollection(configuration.Endpoints);
            _topics = configuration.Topics.ToList();
            _sendRules = configuration.SendRules.ToList();
            _handlingRules = configuration.HandlingRules.ToList();
            _subscriptions = configuration.Subscriptions.ToList();
        }
 public TimeTableSearchViewModel(ITransportService transportService)
 {
     this.SearchParameter = new TimeTableSearchModel();
     this.InitializeSearchConnectionCommand(transportService);
 }
 public BackgroundWorkerArgs(ITransportService transportService, string stationQuery)
 {
     this.TransportService = transportService;
     this.StationQuery = stationQuery;
 }
예제 #43
0
        private void InitializeSearchStationCommand(ITransportService transportService)
        {
            var searchStationCommand = new SearchStationAsyncCommand(transportService);

            searchStationCommand.StationSearchCompleted += this.StationSearchCompletedHandler;
            searchStationCommand.BeginStationSearch += this.BeginStationSearchHandler;

            this.SearchStationCommand = searchStationCommand;
        }
        public void SetUp()
        {
            this.transportService = A.Fake<ITransportService>();

            this.testee = new SearchStationViewModel(this.transportService);
        }
        public void SetUp()
        {
            this.transportService = A.Fake<ITransportService>();

            this.testee = new StationTimeTableViewModel(this.transportService);
        }
예제 #46
0
 public UserInteractor(ITransportService transportService)
 {
     _transportService = transportService;
 }
 public SearchConnectionAsyncCommand(ITransportService transportService)
 {
     this.transportService = transportService;
 }
 public BackgroundWorkerArgs(ITransportService transportService, DateTime startTime, string from, string to)
 {
     this.TransportService = transportService;
     this.StartTime = startTime;
     this.From = @from;
     this.To = to;
 }
        public void SetUp()
        {
            this.transportService = A.Fake<ITransportService>();

            this.testee = new SearchStationAsyncCommand(this.transportService);
        }