// { "tokenData" , "oGeDb2sML1YU8EcNOKsLHurG/H86MFoAws/cb7+1FUY="},

        #region Constructor
        public CheckoutPageViewModel(ProfileDataService userDataService, CartDataService cartDataService,
                                     CatalogDataService catalogDataService)
        {
            ButtonActive            = true;
            this.userDataService    = userDataService;
            this.cartDataService    = cartDataService;
            this.catalogDataService = catalogDataService;
            var app = Application.Current as App;

            DeliveryAddress    = new ObservableCollection <Address>();
            PaymentModes       = new ObservableCollection <Payment>();
            MinimumOrderAmount = (double)app.MinimumOrderAmount;
            Device.BeginInvokeOnMainThread(() =>
            {
                FetchPaymentOptions();
                FetchCartList();
                GetPaymentAndPriceMessage();
                GetPaymentCredentials();
                CheckLocationPermissions();
            });
            EditCommand           = new Command(EditClicked);
            AddAddressCommand     = new Command(AddAddressClicked);
            PlaceOrderCommand     = new Command(PlaceOrderClicked);
            PaymentOptionCommand  = new Command(PaymentOptionClicked);
            ApplyCouponCommand    = new Command(ApplyCouponClicked);
            AddressChanged        = new Command(addressChangedClicked);
            DeliveryOptionCommand = new Command(GetSelectedDeliveryAddressId);
            StateChangedCommand   = new Command(GetSelectedPaymentOption);
            //Task.Run(() => CheckLocationPermissions());
        }
        public void GetAllPiesAsync_Throws_Exception_When_RequestProvider_Thhrows_Exception()
        {
            var requestProviderMock = new Mock <IRequestProvider>();

            requestProviderMock
            .Setup(e => e.GetAsync <IList <Pie> >(It.IsAny <string>(), It.IsAny <string>()))
            .Throws(new ArgumentException());

            var casheMock = new Mock <IBaseCacheStrategy>();

            ICatalogDataService dataService
                = new CatalogDataService(requestProviderMock.Object, casheMock.Object);

            Assert.ThrowsAsync <CatalogDataServiceException>(async() => await dataService.GetAllPiesAsync());
        }
        public void Throws_Exception_When_RequestProvider_Thhrows_Exception()
        {
            var requestProviderMock = new Mock <IRequestProvider>();

            var piesOfTheWeek = PieListMock.MockPieCatalog().Where(p => p.IsPieOfTheWeek == true).ToList();

            requestProviderMock
            .Setup(e => e.GetAsync <IList <Pie> >(It.IsAny <string>(), It.IsAny <string>()))
            .Throws(new ArgumentException());

            var casheMock = new Mock <IBaseCacheStrategy>();

            ICatalogDataService dataService
                = new CatalogDataService(requestProviderMock.Object, casheMock.Object);

            Assert.ThrowsAsync <CatalogDataServiceException>(async() => await dataService.GetPiesOfTheWeekAsync());
        }
        public async Task GetAllPiesAsync()
        {
            var requestProviderMock = new Mock <IRequestProvider>();

            requestProviderMock
            .Setup(e => e.GetAsync <IList <Pie> >(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.FromResult <IList <Pie> >(PieListMock.MockPieCatalog()));

            var casheMock = new Mock <IBaseCacheStrategy>();

            ICatalogDataService dataService
                = new CatalogDataService(requestProviderMock.Object, casheMock.Object);

            var serviceCallResult = await dataService.GetAllPiesAsync();

            Assert.IsNotNull(serviceCallResult);
            Assert.AreEqual(PieListMock.MockPieCatalogCount(), serviceCallResult.Count);
        }
        public async Task GetAllPiesOfTheWeekAsync()
        {
            var requestProviderMock = new Mock <IRequestProvider>();

            var piesOfTheWeek = PieListMock.MockPieCatalog().Where(p => p.IsPieOfTheWeek == true).ToList();

            requestProviderMock
            .Setup(e => e.GetAsync <List <Pie> >(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.FromResult <List <Pie> >(piesOfTheWeek));

            var casheMock = new Mock <IBaseCacheStrategy>();

            ICatalogDataService dataService
                = new CatalogDataService(requestProviderMock.Object, casheMock.Object);

            var serviceCallResult = await dataService.GetPiesOfTheWeekAsync();

            Assert.IsNotNull(serviceCallResult);
            Assert.AreEqual(piesOfTheWeek.Count, serviceCallResult.ToList().Count);
        }