Пример #1
0
        public async Task DeleteAsync_Should_Remove_Item()
        {
            using (var context = await InMemoryDbContext.GetContext().SeedDabase(TestSeed.GetItemsForTesting()))
            {
                //arrange
                var repository = new ToDoItemRepository(context);

                //act
                var itemToDelete = await context.ToDoItems.FirstAsync();

                var totalItems = await context.ToDoItems.CountAsync();

                await repository.DeleteAsync(itemToDelete.Id);

                //assert
                context.ToDoItems.Count().Should().Be(totalItems - 1);
            }
        }