public async Task TestCrudOperationsAsync()
        {
            // Create items
            await TestCreatePricesAsync();

            // Get all prices
            var page = await _persistence.GetPageByFilterAsync(
                null,
                new FilterParams(),
                new PagingParams()
                );

            Assert.NotNull(page);
            Assert.Equal(3, page.Data.Count);

            var price1 = page.Data[0];

            // Update the price
            price1.Note = "ABC";

            var price = await _persistence.UpdateAsync(null, price1);

            Assert.NotNull(price);
            Assert.Equal(price1.Id, price.Id);
            Assert.Equal("ABC", price.Note);

            // Get price by udi
            price = await _persistence.GetOneBySkuAsync(null, price1.Sku);

            Assert.NotNull(price);
            Assert.Equal(price1.Id, price.Id);

            // Delete the price
            price = await _persistence.DeleteByIdAsync(null, price1.Id);

            Assert.NotNull(price);
            Assert.Equal(price1.Id, price.Id);

            // Try to get deleted price
            price = await _persistence.GetOneByIdAsync(null, price1.Id);

            Assert.Null(price);
        }
Exemple #2
0
 public async Task <PriceV1> GetPriceBySkuAsync(string correlationId, string udi)
 {
     return(await _persistence.GetOneBySkuAsync(correlationId, udi));
 }