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(); }
public Task MoveToNextAsync(Vehicle vehicle) { _infoService.SetCurrentVehicle(vehicle); return(_navigationService.MoveToNextAsync()); }