Ejemplo n.º 1
0
        protected override void AdditionalSetup()
        {
            _fixture = new Fixture().Customize(new AutoMoqCustomization());
            _fixture.OmitProperty("EffectiveDateString");

            IDriverRepository     driverRepo     = Mock.Of <IDriverRepository>(dr => dr.GetByIDAsync(It.IsAny <Guid>()) == Task.FromResult(_fixture.Create <Driver>()));
            IVehicleRepository    vehicleRepo    = Mock.Of <IVehicleRepository>(vr => vr.GetByIDAsync(It.IsAny <Guid>()) == Task.FromResult(_fixture.Create <Vehicle>()));
            IMobileDataRepository mobileDataRepo = Mock.Of <IMobileDataRepository>(mdr => mdr.GetByIDAsync(It.IsAny <Guid>()) == Task.FromResult(_fixture.Create <MobileData>()));

            var mockGpsService = _fixture.InjectNewMock <IGpsService>();

            mockGpsService.Setup(mgps => mgps.GetSmpData(MWF.Mobile.Core.Enums.ReportReason.Begin)).Returns("SMP-BEGIN");
            mockGpsService.Setup(mgps => mgps.GetSmpData(MWF.Mobile.Core.Enums.ReportReason.Drive)).Returns("SMP-DRIVE");
            mockGpsService.Setup(mgps => mgps.GetSmpData(MWF.Mobile.Core.Enums.ReportReason.OnSite)).Returns("SMP-ONSITE");
            mockGpsService.Setup(mgps => mgps.GetSmpData(MWF.Mobile.Core.Enums.ReportReason.Complete)).Returns("SMP-COMPLETE");

            IRepositories repos = Mock.Of <IRepositories>(r => r.DriverRepository == driverRepo && r.VehicleRepository == vehicleRepo && r.MobileDataRepository == mobileDataRepo);

            _fixture.Register <IRepositories>(() => repos);

            _mockGatewayQueuedService = new Mock <IGatewayQueuedService>();

            _mockGatewayQueuedService.Setup(mgqs => mgqs.AddToQueueAsync("fwSyncChunkToServer", It.IsAny <MobileApplicationDataChunkCollection>(), null))
            .Callback <string, MobileApplicationDataChunkCollection, Parameter[]>((s, m, p) => { _mobileDataChunkCollection = m; })
            .Returns(Task.FromResult(0));

            _mockGatewayQueuedService.Setup(mgqs => mgqs.AddToQueueAsync("fwSyncPhotos", It.IsAny <UploadCameraImageObject>(), null))
            .Callback <string, UploadCameraImageObject, Parameter[]>((s, uo, p) => { _uploadImageObject = uo; })
            .Returns(Task.FromResult(0));

            _fixture.Inject <IGatewayQueuedService>(_mockGatewayQueuedService.Object);

            _mockInfoService = _fixture.InjectNewMock <IInfoService>();
        }
Ejemplo n.º 2
0
 public InboxViewModel(
     IRepositories repositories,
     IInfoService infoService,
     INavigationService navigationService,
     IGatewayPollingService gatewayPollingService)
 {
     _mobileDataRepository  = repositories.MobileDataRepository;
     _infoService           = infoService;
     _navigationService     = navigationService;
     _gatewayPollingService = gatewayPollingService;
 }
Ejemplo n.º 3
0
        public ManifestViewModel(IRepositories repositories, INavigationService navigationService, IReachability reachability, IToast toast,
                                 IGatewayPollingService gatewayPollingService, IGatewayQueuedService gatewayQueuedService, IInfoService infoService)
        {
            _mobileDataRepository         = repositories.MobileDataRepository;
            _applicationProfileRepository = repositories.ApplicationRepository;

            _navigationService     = navigationService;
            _reachability          = reachability;
            _toast                 = toast;
            _gatewayPollingService = gatewayPollingService;
            _gatewayQueuedService  = gatewayQueuedService;
            _infoService           = infoService;

            _initialised = true;

            Mvx.Resolve <ICheckForSoftwareUpdates>().Check();

            CreateSections();
        }
Ejemplo n.º 4
0
 public Repositories(IApplicationProfileRepository applicationRepository, ICurrentDriverRepository currentDriverRepository, ICustomerRepository customerRepository, IDeviceRepository deviceRepository,
                     IDriverRepository driverRepository, IGatewayQueueItemRepository gatewayQueueItemRepository, ILatestSafetyCheckRepository latestSafetyCheckRepository, ILogMessageRepository logMessageRepository,
                     ISafetyProfileRepository safetyProfileRepository, IVehicleRepository vehicleRepository, ITrailerRepository trailerRepository, IVerbProfileRepository verbProfileRepository, IConfigRepository configRepository, IMobileDataRepository mobileDataRepository)
 {
     ApplicationRepository       = applicationRepository;
     ConfigRepository            = configRepository;
     CurrentDriverRepository     = currentDriverRepository;
     CustomerRepository          = customerRepository;
     DeviceRepository            = deviceRepository;
     DriverRepository            = driverRepository;
     GatewayQueueItemRepository  = gatewayQueueItemRepository;
     LatestSafetyCheckRepository = latestSafetyCheckRepository;
     LogMessageRepository        = logMessageRepository;
     SafetyProfileRepository     = safetyProfileRepository;
     TrailerRepository           = trailerRepository;
     VehicleRepository           = vehicleRepository;
     VerbProfileRepository       = verbProfileRepository;
     TrailerRepository           = trailerRepository;
     MobileDataRepository        = mobileDataRepository;
 }