Exemplo n.º 1
0
        public async Task GivenCataloguePriceExists(Table table)
        {
            IDictionary <int, int> cataloguePriceDictionary = new Dictionary <int, int>();

            IDictionary <string, int> catalogueItemIdPriceIdDictionary = new Dictionary <string, int>();

            foreach (var cataloguePrice in table.CreateSet <CataloguePriceTable>())
            {
                var price = CataloguePriceEntityBuilder.Create()
                            .WithCatalogueItemId(cataloguePrice.CatalogueItemId)
                            .WithPriceTypeId((int)cataloguePrice.CataloguePriceTypeEnum)
                            .WithProvisioningTypeId((int)cataloguePrice.ProvisioningTypeEnum)
                            .WithCurrencyCode(cataloguePrice.CurrencyCode)
                            .WithPrice(cataloguePrice.Price)
                            .WithPricingUnitId(cataloguePrice.PricingUnitId)
                            .WithTimeUnit((int)cataloguePrice.TimeUnitEnum == -1 ? (int?)null : (int)cataloguePrice.TimeUnitEnum)
                            .Build();

                var cataloguePriceId = await price.InsertAsync <int>();

                if (cataloguePrice.CataloguePriceTierRef != null)
                {
                    cataloguePriceDictionary.Add((int)cataloguePrice.CataloguePriceTierRef, cataloguePriceId);
                }

                if (!string.IsNullOrEmpty(cataloguePrice.CataloguePriceIdRef))
                {
                    catalogueItemIdPriceIdDictionary.Add(cataloguePrice.CataloguePriceIdRef, cataloguePriceId);
                }
            }

            _context[ScenarioContextKeys.CatalogueTierMapDictionary] = cataloguePriceDictionary;

            _context[ScenarioContextKeys.CataloguePriceIdMapDictionary] = catalogueItemIdPriceIdDictionary;
        }
Exemplo n.º 2
0
        private static async Task <int> InsertTieredPriceAsync(string solutionId)
        {
            var priceId = await CataloguePriceEntityBuilder.Create()
                          .WithPriceTypeId(2)
                          .WithCatalogueItemId(solutionId)
                          .Build().InsertAsync <int>();

            return(priceId);
        }
Exemplo n.º 3
0
 private static async Task <int> InsertPriceAsync(string solutionId)
 {
     return(await CataloguePriceEntityBuilder.Create()
            .WithCatalogueItemId(solutionId)
            .Build().InsertAsync <int>());
 }