예제 #1
0
        public async Task TestCrudOperationsAsync()
        {
            // Create items
            await TestCreateCustomersAsync();

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

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

            var customer1 = page.Data[0];

            // Update the customer
            customer1.FirstName = "ABC";

            var customer = await _persistence.UpdateAsync(null, customer1);

            Assert.NotNull(customer);
            Assert.Equal(customer1.Id, customer.Id);
            Assert.Equal("ABC", customer.FirstName);

            // Delete the customer
            customer = await _persistence.DeleteByIdAsync(null, customer1.Id);

            Assert.NotNull(customer);
            Assert.Equal(customer1.Id, customer.Id);

            // Try to get deleted customer
            customer = await _persistence.GetByIdAsync(null, customer1.Id);

            Assert.Null(customer);
        }
예제 #2
0
 public async Task <CustomerV1> DeleteCustomerByIdAsync(string correlationId, string id)
 {
     return(await _persistence.DeleteByIdAsync(correlationId, id));
 }