Esempio n. 1
0
        // Tests that when a processed barcode item is selected it shows the barcode status modal
        public async Task BarcodeItemVM_Select_MultiSelect_Processed()
        {
            base.ClearAll();

            var navData = new NavData <MobileData>()
            {
                Data = _mobileData
            };
            var navID = Guid.NewGuid();

            _mockNavigationService.Setup(ns => ns.GetNavData <MobileData>(navID)).Returns(navData);

            await _barcodeScanningViewModel.Init(navID);

            var barcodeItemVM = new BarcodeItemViewModel(_mockNavigationService.Object, _damageStatuses, _barcodeScanningViewModel);

            barcodeItemVM.IsDelivered = true;

            // on the parent barcode model, mark snother of the other barcode items as processed (and selected)
            var selectedBarcodeItem = _barcodeScanningViewModel.BarcodeSections[0].Barcodes[0];

            _barcodeScanningViewModel.MarkBarcodeAsProcessed(selectedBarcodeItem);
            selectedBarcodeItem.IsSelected = true;

            await barcodeItemVM.SelectBarcodeAsync();

            // Check the selected barcode was passed into the modal as the part of the nav data
            _mockNavigationService.Verify(ns => ns.ShowModalViewModel <BarcodeStatusViewModel, bool>(
                                              It.Is <NavData <BarcodeItemViewModel> >(x => x.Data == barcodeItemVM && (x.OtherData["SelectedBarcodes"] as List <BarcodeItemViewModel>)[0] == selectedBarcodeItem),
                                              It.IsAny <Action <bool> >()));
        }
Esempio n. 2
0
        // Tests that when an unprocessed barcode item is selected it shows the confirm dialog then calls "MarkAsProcessed" on the parent barcode scanning view model
        public async Task BarcodeItemVM_Select_Unprocessed()
        {
            base.ClearAll();

            var navData = new NavData <MobileData>()
            {
                Data = _mobileData
            };
            var navID = Guid.NewGuid();

            _mockNavigationService.Setup(ns => ns.GetNavData <MobileData>(navID)).Returns(navData);

            await _barcodeScanningViewModel.Init(navID);

            var barcodeItemVM = new BarcodeItemViewModel(_mockNavigationService.Object, _damageStatuses, _barcodeScanningViewModel);

            _mockUserInteraction.ConfirmAsyncReturnsTrueIfTitleStartsWith("Mark Barcode as");

            await barcodeItemVM.SelectBarcodeAsync();

            Assert.Equal(barcodeItemVM, _barcodeScanningViewModel.MarkAsProcessedBarcodeItem);
            Assert.False(_barcodeScanningViewModel.MarkAsProcessedWasScanned);
        }
Esempio n. 3
0
        // Tests that when a processed barcode item is selected it shows the barcode status modal
        public async Task BarcodeItemVM_Select_SingleSelect_Processed()
        {
            base.ClearAll();

            var navData = new NavData <MobileData>()
            {
                Data = _mobileData
            };
            var navID = Guid.NewGuid();

            _mockNavigationService.Setup(ns => ns.GetNavData <MobileData>(navID)).Returns(navData);

            await _barcodeScanningViewModel.Init(navID);

            var barcodeItemVM = new BarcodeItemViewModel(_mockNavigationService.Object, _damageStatuses, _barcodeScanningViewModel);

            barcodeItemVM.IsDelivered = true;

            await barcodeItemVM.SelectBarcodeAsync();

            _mockNavigationService.Verify(ns => ns.ShowModalViewModel <BarcodeStatusViewModel, bool>(
                                              It.Is <NavData <BarcodeItemViewModel> >(x => x.Data == barcodeItemVM),
                                              It.IsAny <Action <bool> >()));
        }