public async Task Should_Return_Default_Store() { // Arrange & Act var response = await _storeAppService.GetDefaultAsync(); // Assert response.ShouldNotBeNull(); response.Name.ShouldBe("My store"); }
public virtual async Task OnGetAsync() { //TODO: Need to handle: when StoreId is empty, and current user owns multiple store if (!StoreId.HasValue && CurrentUser.Id.HasValue) { var storeOwners = await _storeOwnerAppService.GetListAsync(new GetStoreOwnerListDto { OwnerUserId = CurrentUser.Id.Value, }); StoreId = storeOwners.Items.FirstOrDefault()?.StoreId; } if (!StoreId.HasValue) { var defaultStore = await _storeAppService.GetDefaultAsync(); StoreId = defaultStore.Id; } StoreName = (await _storeAppService.GetAsync(StoreId.Value)).Name; }
public async Task OnGetAsync() { if (CurrentUser.Id is null) { return; } OrderList = await _orderAppService.GetListAsync(new GetOrderListDto { MaxResultCount = 5, CustomerUserId = CurrentUser.GetId(), Sorting = "CreationTime DESC" }); Store = await _storeAppService.GetDefaultAsync(); CakeProduct = await _productAppService.GetByUniqueNameAsync(Store.Id, SampleDataConsts.CakeProductUniqueName); Order = OrderList.Items.FirstOrDefault(x => x.OrderStatus is OrderStatus.Pending && x.OrderLines.Any(ol => ol.ProductId == CakeProduct.Id)); Wallet = (await _accountAppService.GetListAsync(new GetAccountListInput { UserId = CurrentUser.Id })).Items[0]; }
public Task <StoreDto> GetDefaultAsync() { return(_service.GetDefaultAsync()); }