public async Task AddProductAsyncWithInvalidProductShouldNotAddProduct()
        {
            var options = new DbContextOptionsBuilder <PhotoparallelDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var dbContext = new PhotoparallelDbContext(options);

            var rent = new Rent {
                RentStatus = RentStatus.Open
            };

            var userService = new Mock <IUsersService>();

            var     productId      = 1;
            Product product        = null;
            var     productService = new Mock <IProductsService>();

            productService.Setup(p => p.GetProductByIdAsync(productId))
            .ReturnsAsync(product);

            var invoicesService = new Mock <IInvoicesService>();

            var rentsService = new RentsService(dbContext, userService.Object, invoicesService.Object, productService.Object);

            await rentsService.AddProductAsync(productId, rent);

            var rentProducts = dbContext.RentProducts.ToList();

            Assert.Empty(rentProducts);
        }
        public async Task AddProductAsyncShouldAddProduct()
        {
            var options = new DbContextOptionsBuilder <PhotoparallelDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var dbContext = new PhotoparallelDbContext(options);

            var rent = new Rent {
                RentStatus = RentStatus.Open
            };

            var userService = new Mock <IUsersService>();

            var productId      = 1;
            var productService = new Mock <IProductsService>();

            productService.Setup(p => p.GetProductByIdAsync(productId))
            .ReturnsAsync(new Product {
                Name = "Canon M50", PricePerDay = 100
            });

            var invoicesService = new Mock <IInvoicesService>();

            var rentsService = new RentsService(dbContext, userService.Object, invoicesService.Object, productService.Object);

            await rentsService.AddProductAsync(productId, rent);

            var rentProducts = dbContext.RentProducts.ToList();

            Assert.Single(rentProducts);
            Assert.Equal(rent.Id, rentProducts.First().RentId);
        }