Beispiel #1
0
 public override void Setup()
 {
     base.Setup();
     useCase_openShop = new UseCase_OpenShop(SystemContext, UserInfo);
     useCase_openShop.Setup();
     ShopId = useCase_openShop.Success_Normal(ShopImage.ShopInfo);
 }
 public override void Setup()
 {
     base.Setup();
     useCase_openShop = new UseCase_OpenShop(SystemContext, ShopOwnerUser);
     useCase_openShop.Setup();
     shopId = useCase_openShop.Success_Normal(ShopInfo);
     new UseCase_LogOut_TestLogic(SystemContext).Success_Normal();
 }
        public ProductId?AddProductToShop(ShopId shopId, ProductInfo productInfo)
        {
            Result <Product> result = marketProductsService.AddProduct
                                      (
                ProductInfo.ToProductData(productInfo),
                shopId,
                Username
                                      ).Result;

            return(result.IsErr ? (ProductId?)null : new ProductId(result.Ret.Id));
        }
        public bool EditProductInShop(ShopId shopId, ProductId productId, ProductInfo newProductDetails)
        {
            string result = marketProductsService.EditProductAsync
                            (
                productId,
                ProductInfo.ToProductData(newProductDetails),
                shopId,
                Username
                            ).Result;

            return(result == "Product edited");
        }
        public void Success_Normal(ShopId shopId, IEnumerable <ProductIdentifiable> expected)
        {
            IEnumerable <ProductIdentifiable>?resultProducts = MarketBridge.GetShopProducts(shopId);

            Assert.IsNotNull(resultProducts);
            Assert.IsTrue(resultProducts.All(x => x.ProductId.IsValid()), $"contains invalid product IDs");
            new Assert_SetEquals <ProductIdentifiable>
            (
                expected,
                ProductIdentifiable.DeepEquals
            ).AssertEquals(resultProducts);
        }
        public ShopInfo?GetShopDetails(ShopId shopId)
        {
            //ICollection<StoreData>? shopDetails = marketStoreGeneralService.FindStoresByName(shopId.ShopName);
            //if (shopDetails == null || shopDetails.Count == 0)
            //{
            //    return null;
            //}
            //if (shopDetails.Count > 1)
            //{
            //    throw new SharedDataMismatchException("There are multiple shops with the same name");
            //}

            //StoreData storeData = shopDetails.FirstOrDefault();
            //return new ShopInfo();
            throw new NotImplementedException("The service layer currently doesn't return any information about the shop.");
        }
Beispiel #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlayerId != 0UL)
            {
                hash ^= PlayerId.GetHashCode();
            }
            if (ShopId != 0)
            {
                hash ^= ShopId.GetHashCode();
            }
            if (ItemId != 0)
            {
                hash ^= ItemId.GetHashCode();
            }
            return(hash);
        }
Beispiel #8
0
 public ShopRefs(ShopId shopId, UserInfo owner)
 {
     Id    = shopId;
     Owner = owner;
 }
Beispiel #9
0
 public IEnumerable <ReadModel.Order> GetAllFor(ShopId shopId)
 {
     throw new System.NotImplementedException();
 }
        public bool RemoveProductFromShop(ShopId shopId, ProductId productId)
        {
            string result = marketProductsService.RemoveProductAsync(productId, shopId, Username).Result;

            return(result == "Product removed");
        }
        public IEnumerable <ProductIdentifiable>?GetShopProducts(ShopId shopId)
        {
            ICollection <ProductData>?products = marketProductsService.FindProductsByStoresAsync(shopId.ShopName).Result;

            return(products?.Select(ProductIdentifiable.FromProductData));
        }
Beispiel #12
0
 public string ShopTitle()
 {
     return(string.IsNullOrEmpty(ShopLetter)
        ? ShopId.ToString()
        : string.Format("{0}-{1}", ShopId, ShopLetter));
 }