Example #1
0
        public async Task AddStoreAsync_When_Parameter_Null_Should_Return_Something_Went_Wrong()
        {
            //arrange
            var expectedResult = new OperationDetails(false, "Something went wrong", "Store");

            //act
            var actualResult = await storeService.AddStoreAsync(null);

            //assert
            actualResult.Should().BeEquivalentTo(expectedResult);
        }
        private async void CloseDialog()
        {
            var location = new SimpleWaypoint(Address);
            await SimpleWaypoint.TryGeocodeWaypoints(new List <SimpleWaypoint>() { location }, "AttsGkqIHCOIEA11KtQZDphl5bi8lppin64jeg-ZOOhiS4cdHA_EXJwHSbyZi4Xo");

            var store = new Store()
            {
                Id       = Guid.NewGuid(),
                Name     = Name,
                Location = new StoreLocation()
                {
                    Id        = Guid.NewGuid(),
                    Address   = location.Address,
                    longitude = location.Coordinate.Longitude,
                    latitude  = location.Coordinate.Latitude
                },
                PhoneNumber = PhoneNumber,
                Website     = Website,
                Img         = Img,
                IceCreams   = new List <IceCream>()
            };

            try
            {
                await Task.Run(() => storeService.AddStoreAsync(store));

                ClearFeilds();
                DialogHost.CloseDialogCommand.Execute(store, null);
            }
            catch (Exception ex)
            {
                IsError = true;
            }
        }
Example #3
0
        public async Task AddStoreAsync(DrxStoreViewModel store)
        {
            Analytics.TrackEvent("Store created.");

            Stores.Add(store);
            await Task.Run(async() =>
            {
                await Model.AddStoreAsync(store.Model);
                await Model.SaveStoreCache();
            }).ConfigureAwait(false);
        }