public async Task AddToBasket_ReturnsLaptopConfigurationList()
        {
            // Arrange
            var mockRepo = new Mock <ILaptopRepository>();

            mockRepo.Setup(s => s.GetLaptopList())
            .ReturnsAsync(MockDataProvider.GetMockLaptopList());
            mockRepo.Setup(s => s.GetConfigurationList())
            .ReturnsAsync(MockDataProvider.GetMockLaptopConfigurationList());
            mockRepo.Setup(s => s.AddToBasket(It.IsAny <BasketItem>()))
            .ReturnsAsync(MockDataProvider.GetBasketItems());
            var service = new LaptopService(mockRepo.Object);

            // Act
            var result = await service.AddToBasket(It.IsAny <BasketItem>());

            // Assert
            var returnValue = Assert.IsType <BasketViewModel>(result);

            Assert.NotNull(returnValue);
            var basketItems = Assert.IsType <List <BasketItems> >(returnValue.BasketItems);
            var basketItem  = basketItems.FirstOrDefault();

            Assert.NotNull(basketItem);
            Assert.NotNull(basketItem.Laptop);
            Assert.Equal("Dell", basketItem.Laptop.Name);

            var configurations = Assert.IsType <List <LaptopConfiguration> >(basketItem.LaptopConfigurations);
            var configuration  = configurations.FirstOrDefault();

            Assert.NotNull(configuration);
            Assert.Equal((decimal)45.67, configuration.Price);
        }
        public async Task AddToBasket_ReturnsLaptopConfigurationList()
        {
            // Arrange
            await using var context = new LaptopShopContext(_options);
            await context.Basket.AddRangeAsync(MockDataProvider.GetBasketItems());

            await context.SaveChangesAsync();

            // Act
            var item = new BasketItem
            {
                LaptopId = 2,
                LaptopConfigurationIdList = new List <int> {
                    1, 4, 5
                }
            };
            var result = await new LaptopRepository(context).AddToBasket(item);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <Basket[]>(result);
            Assert.Equal(6, result.Length);
            Assert.Equal(2, result.Select(r => r.LaptopId).Distinct().Count());
        }