protected override void AdditionalSetup() { _fixture = new Fixture().Customize(new AutoMoqCustomization()); _fixture.Register <IReachability>(() => Mock.Of <IReachability>(r => r.IsConnected() == true)); _mockMobileConfig = _fixture.Build <MWFMobileConfig>().With(m => m.HEUrl, "http://demo.proteoenterprise.co.uk").Create <MWFMobileConfig>(); _mockGpsService = _fixture.InjectNewMock <IGpsService>(); _mockGpsService.Setup(mgs => mgs.GetLatitude()).Returns(1); _mockGpsService.Setup(mgs => mgs.GetLongitude()).Returns(2); _mockConfigRepo = _fixture.InjectNewMock <IConfigRepository>(); _mockConfigRepo.Setup(mcr => mcr.GetAsync()).ReturnsAsync(_mockMobileConfig); _fixture.Inject <IRepositories>(_fixture.Create <Repositories>()); var response = new Core.HttpResult <HttpResponseMessage> { StatusCode = System.Net.HttpStatusCode.OK, }; _mockHttpService = _fixture.InjectNewMock <Core.Services.IHttpService>(); _mockHttpService.Setup(mhs => mhs.SendAsyncPlainResponse <HttpResponseMessage>(It.IsAny <HttpRequestMessage>())).ReturnsAsync(response); _mockLoggingService = _fixture.InjectNewMock <ILoggingService>(); _mockUserInteraction = Ioc.RegisterNewMock <ICustomUserInteraction>(); _mockToast = Ioc.RegisterNewMock <IToast>(); }
protected override void AdditionalSetup() { _fixture = new Fixture().Customize(new AutoMoqCustomization()); _fixture.Register <IReachability>(() => Mock.Of <IReachability>(r => r.IsConnected() == _isConnected)); _fixture.Register <IDeviceInfo>(() => Mock.Of <IDeviceInfo>(di => di.AndroidId == "TESTID")); _config = _fixture.Create <MWFMobileConfig>(); _mockConfigRepo = new Mock <IConfigRepository>(); _mockConfigRepo.Setup(cr => cr.GetAsync()).ReturnsAsync(_config); _fixture.Inject <IConfigRepository>(_mockConfigRepo.Object); _fixture.Inject <IRepositories>(_fixture.Create <Repositories>()); _mockUpload = _fixture.InjectNewMock <IUpload>(); _mockUpload.Setup(u => u.UploadFileAsync(It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).ReturnsAsync(true); Ioc.RegisterSingleton <IMvxMessenger>(_fixture.Create <IMvxMessenger>()); _mockUserInteraction = Ioc.RegisterNewMock <ICustomUserInteraction>(); }
public async Task Init(Guid navID) { _navData = _navigationService.GetNavData <MobileData>(navID); this.MessageId = navID; _order = _navData.OtherData["Order"] as Item; _mobileData = _navData.Data; _mobileConfig = await _configRepository.GetByIDAsync(_mobileData.CustomerId); this.ChangeOrderQuantity = true && _mobileData.Order.Type != Enums.InstructionType.Deliver;//_mobileConfig.QuantityIsEditable && _mobileData.Order.Type != Enums.InstructionType.Deliver; }
protected override void AdditionalSetup() { _fixture = new Fixture().Customize(new AutoMoqCustomization()); _mobileData = _fixture.Create <MobileData>(); _mockMobileDataRepo = _fixture.InjectNewMock <IMobileDataRepository>(); _mockMobileDataRepo.Setup(mdr => mdr.GetByIDAsync(It.Is <Guid>(i => i == _mobileData.ID))).ReturnsAsync(_mobileData); _mockRepositories = _fixture.InjectNewMock <IRepositories>(); _mockRepositories.Setup(r => r.MobileDataRepository).Returns(_mockMobileDataRepo.Object); Ioc.RegisterSingleton <IRepositories>(_mockRepositories.Object); _mwfMobileConfig = _fixture.Create <MWFMobileConfig>(); _mockConfigRepo = _fixture.InjectNewMock <IConfigRepository>(); _mockConfigRepo.Setup(mcr => mcr.GetByIDAsync(It.IsAny <Guid>())).Returns(() => Task.FromResult(_mwfMobileConfig)); _fixture.Inject <IRepositories>(_fixture.Create <Repositories>()); _navigationService = _fixture.InjectNewMock <INavigationService>(); _mockInfoService = _fixture.InjectNewMock <IInfoService>(); _mockUserInteraction = Ioc.RegisterNewMock <ICustomUserInteraction>(); _mockMessenger = Ioc.RegisterNewMock <IMvxMessenger>(); _mockMessenger.Setup(m => m.Unsubscribe <GatewayInstructionNotificationMessage>(It.IsAny <MvxSubscriptionToken>())); _mockMessenger.Setup(m => m.Subscribe(It.IsAny <Action <GatewayInstructionNotificationMessage> >(), It.IsAny <MvxReference>(), It.IsAny <string>())).Returns(_fixture.Create <MvxSubscriptionToken>()); Ioc.RegisterSingleton <INavigationService>(_navigationService.Object); _navData = new NavData <MobileData>() { Data = _mobileData }; _navData.OtherData["Order"] = _mobileData.Order.Items.FirstOrDefault(); _navID = Guid.NewGuid(); _navigationService.Setup(ns => ns.GetNavData <MobileData>(_navID)).Returns(_navData); }