Exemplo n.º 1
0
        public async Task CardUpdates(UpdateCardType updateCardType)
        {
            await marketApiClient.Products.Put(shop.Id, serviceCard.Id.Value, UpdateCard(serviceCard, updateCardType));

            var page = GoToTomorrowCalendarPage();

            var serviceCardInfo = (serviceCard.Name, serviceCard.PricesInfo.SellPrice);

            page.ShowRecordTooltip(0, 0).CheckServiceItems(serviceCardInfo);
            page.ChangeRecord(0, 0).CheckServiceTokens(serviceCardInfo);
        }
Exemplo n.º 2
0
        private static Product UpdateCard(Product p, UpdateCardType updateCardType)
        {
            // Если эта конструкция будет вызывать сложности, то перепишем на тесты без ветвлений.
            if (updateCardType == UpdateCardType.SwitchFromServiceToProduct)
            {
                p.ProductCategory = ProductCategory.NonAlcoholic;
            }

            if (updateCardType == UpdateCardType.ArchiveCard)
            {
                p.IsArchived = true;
            }

            if (updateCardType == UpdateCardType.DeleteCard)
            {
                p.IsDeleted = true;
            }

            if (updateCardType == UpdateCardType.UpdatePrice)
            {
                p.PricesInfo = new PriceInfo
                {
                    SellPrice = 500,
                    PriceType = PriceType.FixPrice,
                }
            }
            ;

            if (updateCardType == UpdateCardType.DeletePrice)
            {
                p.PricesInfo = new PriceInfo
                {
                    SellPrice = null,
                    PriceType = PriceType.WithoutPrice,
                }
            }
            ;

            return(p);
        }