예제 #1
0
 public SafetyCheckViewModel(IInfoService infoService, INavigationService navigationService, IRepositories repositories, ISafetyCheckService safetyCheckService)
 {
     _infoService        = infoService;
     _repositories       = repositories;
     _navigationService  = navigationService;
     _safetyCheckService = safetyCheckService;
 }
        protected override void AdditionalSetup()
        {
            _mockUserInteraction = new Mock <ICustomUserInteraction>();
            Ioc.RegisterSingleton <ICustomUserInteraction>(_mockUserInteraction.Object);

            _mockMessenger = new Mock <IMvxMessenger>();
            Ioc.RegisterSingleton <IMvxMessenger>(_mockMessenger.Object);

            _fixture = new Fixture().Customize(new AutoMoqCustomization());
            _fixture.OmitProperty("EffectiveDateString");
            _fixture.Customize <InstructionSafetyCheckViewModel>(vm => vm.Without(x => x.SafetyCheckItemViewModels));
            _fixture.Customize <InstructionSafetyCheckViewModel>(vm => vm.Without(x => x.SafetyProfileVehicle));
            _fixture.Customize <SafetyCheckFault>(vm => vm.With(x => x.Status, Core.Enums.SafetyCheckStatus.Passed));

            _driver  = _fixture.Create <Core.Models.Driver>();
            _vehicle = _fixture.Create <Core.Models.Vehicle>();
            _trailer = _fixture.Create <Core.Models.Trailer>();

            _infoService = _fixture.Create <InfoService>();
            _fixture.Inject <IInfoService>(_infoService);
            _infoService.SetCurrentDriver(_driver);
            _infoService.SetCurrentVehicle(_vehicle);

            _safetyCheckService = _fixture.Create <SafetyCheckService>();
            _fixture.Inject <ISafetyCheckService>(_safetyCheckService);

            _mobileData = _fixture.SetUpInstruction(Core.Enums.InstructionType.Collect, false, true, false, false, false, false, true, null);
            _navData    = new NavData <MobileData>()
            {
                Data = _mobileData
            };

            _navData.OtherData["UpdatedTrailer"] = _trailer;

            _safetyCheckService.CurrentVehicleSafetyCheckData   = _vehicleSafetyCheckData = _fixture.Create <SafetyCheckData>();
            _navData.OtherData["UpdatedTrailerSafetyCheckData"] = _trailerSafetyCheckData = _fixture.Create <SafetyCheckData>();

            var mockMobileDataRepo = _fixture.InjectNewMock <IMobileDataRepository>();

            mockMobileDataRepo.Setup(mdr => mdr.GetByIDAsync(It.Is <Guid>(i => i == _mobileData.ID))).ReturnsAsync(_mobileData);

            _mockSafetyProfileRepository = _fixture.InjectNewMock <ISafetyProfileRepository>();
            _mockConfigRepository        = _fixture.InjectNewMock <IConfigRepository>();
            _mockVehicleRepo             = _fixture.InjectNewMock <IVehicleRepository>();

            _mockVehicleRepo.Setup(vr => vr.GetByIDAsync(_vehicle.ID)).ReturnsAsync(_vehicle);

            var repositories = _fixture.Create <Repositories>();

            _fixture.Inject <IRepositories>(repositories);

            _mockNavigationService = _fixture.InjectNewMock <INavigationService>();
            Ioc.RegisterSingleton <INavigationService>(_mockNavigationService.Object);

            _safetyProfiles = CreateSafetyProfiles();
        }
예제 #3
0
 public InstructionSafetyCheckSignatureViewModel(Services.IInfoService infoService, Services.IGatewayQueuedService gatewayQueuedService, ICustomUserInteraction userInteraction, Repositories.IRepositories repositories, INavigationService navigationService, ISafetyCheckService safetyCheckService)
     : base(infoService, gatewayQueuedService, userInteraction, repositories, navigationService, safetyCheckService)
 {
 }
 public InstructionSafetyCheckViewModel(IInfoService infoService, INavigationService navigationService, IRepositories repositories, ISafetyCheckService safetyCheckService)
     : base(infoService, navigationService, repositories, safetyCheckService)
 {
 }
예제 #5
0
 public SafetyCheckSignatureViewModel(Services.IInfoService infoService, Services.IGatewayQueuedService gatewayQueuedService, ICustomUserInteraction userInteraction, Repositories.IRepositories repositories, INavigationService navigationService, ISafetyCheckService safetyCheckService)
 {
     _infoService          = infoService;
     _gatewayQueuedService = gatewayQueuedService;
     _userInteraction      = userInteraction;
     _navigationService    = navigationService;
     _repositories         = repositories;
     _safetyCheckService   = safetyCheckService;
 }