public async void ShouldReturnAllShoppingLists()
        {
            IEnumerable <ShoppingList> shoppingLists = new List <ShoppingList>
            {
                Mock.Of <ShoppingList>(),
                Mock.Of <ShoppingList>(),
                Mock.Of <ShoppingList>()
            };

            var mockRepository = new Mock <IRepository <ShoppingList> >();

            mockRepository.Setup(mock => mock.GetAllAsync())
            .ReturnsAsync(shoppingLists);

            _repository = mockRepository.Object;
            _service    = new ShoppingListService(_repository);
            _controller = new ShoppingListController(_service);


            IActionResult result = await _controller.GetAllShoppingListsAsync();


            result.Should().BeOfType <ObjectResult>()
            .Which.Value.Should().BeAssignableTo <IApiResponse>()
            .Which.Result.Should().BeAssignableTo <IEnumerable <ShoppingList> >()
            .Which.Count().Should().Be(3);
        }
        public async void Should_ReturnOneShoppingList()
        {
            var options = ReturnDbContextOptions("Should_ReturnOneShoppingList");

            // Arrange
            using (var context = new ShoppingListContext(options))
            {
                await context.ShoppingList.AddAsync(new ShoppingList
                {
                    Name      = "Test",
                    BudgetSum = 20
                });

                await context.SaveChangesAsync();
            }

            using (var context = new ShoppingListContext(options))
            {
                var sut = new ShoppingListController(new Repository(context));

                // Act
                var result = await sut.GetAllShoppingListsAsync();

                // Assert
                Assert.Single(result.Value);
            }
        }
        public async void Should_ReturnMoreThanOneShoppingList()
        {
            var options = ReturnDbContextOptions("Should_ReturnMoreThanOneShoppingList");

            // Arrange
            using (var context = new ShoppingListContext(options))
            {
                await context.ShoppingList.AddRangeAsync(
                    new ShoppingList { Name = "Test1", BudgetSum = 10 },
                    new ShoppingList { Name = "Test2", BudgetSum = 15 });

                await context.SaveChangesAsync();
            }

            using (var context = new ShoppingListContext(options))
            {
                var sut = new ShoppingListController(new Repository(context));

                // Act
                var result = await sut.GetAllShoppingListsAsync();

                // Assert
                Assert.True(result.Value.Count > 1);
                Assert.Equal(2, result.Value.Count);
            }
        }
        public async void Should_NotReturnAnyShoppingLists()
        {
            var options = ReturnDbContextOptions("Should_NotReturnAnyShoppingLists");

            // Arrange
            using (var context = new ShoppingListContext(options))
            {
                var sut = new ShoppingListController(new Repository(context));

                // Act
                var result = await sut.GetAllShoppingListsAsync();

                // Assert
                Assert.Empty(result.Value);
            }
        }