public async Task DeleteRentAsyncShouldChangePendingStatusToDenied(int productQuantity, bool isRented, RentStatus rentStatus, RentStatus expectedStatus, bool expextedIsRented, int expectedProductQuantity) { var options = new DbContextOptionsBuilder <PhotoparallelDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var dbContext = new PhotoparallelDbContext(options); var rent = new Rent { RentStatus = rentStatus }; dbContext.Rents.Add(rent); var productService = new Mock <IProductsService>(); var invoicesService = new Mock <IInvoicesService>(); var userService = new Mock <IUsersService>(); var product = new Product { Name = "Canon M50", Quantity = productQuantity, IsRented = isRented }; dbContext.Products.Add(product); var rentProduct = new RentProduct { Product = product, Quantity = 1 }; rent.Products.Add(rentProduct); await dbContext.SaveChangesAsync(); var rentsService = new RentsService(dbContext, userService.Object, invoicesService.Object, productService.Object); await rentsService.DeleteRentAsync(rent.Id); Assert.Equal(expectedStatus, rent.RentStatus); Assert.Equal(expextedIsRented, product.IsRented); Assert.Equal(expectedProductQuantity, product.Quantity); }