// checks that modifying barcode properties doesn't modify properties on the barcode passed in
        // (those changes should only take effect when the user presses "done")
        public async Task BarcodeStatusVM_ModifyBarcode()
        {
            base.ClearAll();

            await this.SetupBarcodeScanningViewModel();

            var barcodeStatusVM = _fixture.Create <BarcodeStatusViewModel>();

            _barcodeItemViewModel1.IsDelivered = true;
            var navData = new NavData <BarcodeItemViewModel>()
            {
                Data = _barcodeItemViewModel1
            };
            var navID = Guid.NewGuid();

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

            barcodeStatusVM.Init(navID);

            var originalBarcode = _barcodeItemViewModel1.Clone();

            // change some properties
            barcodeStatusVM.Barcode.DeliveryComments = "Changed comments";
            barcodeStatusVM.Barcode.IsDelivered      = !barcodeStatusVM.Barcode.IsDelivered;

            // original barcode shouldn't have changed
            Assert.Equal(originalBarcode.IsDelivered, _barcodeItemViewModel1.IsDelivered);
            Assert.Equal(originalBarcode.DeliveryComments, _barcodeItemViewModel1.DeliveryComments);
        }
Exemple #2
0
        public void BarcodeItemVM_Clone()
        {
            base.ClearAll();

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

            var clone = barcodeItemVM.Clone();

            // check the properties we care about have been cloned
            Assert.Equal(_damageStatuses, barcodeItemVM.DamageStatuses);
            Assert.Equal(barcodeItemVM.DamageStatus, barcodeItemVM.DamageStatus);
            Assert.Equal(barcodeItemVM.DeliveryComments, barcodeItemVM.DeliveryComments);
            Assert.Equal(barcodeItemVM.IsDelivered, barcodeItemVM.IsDelivered);
        }