public void GetProductById_ShouldReturnProduct_WhenProductExists()
        {
            //Arrange
            var productId  = Guid.NewGuid();
            var title      = "Playstation 5";
            var price      = 8499;
            var productDto = new ProductModel
            {
                Id       = productId,
                Title    = title,
                Category = new CategoryModel(),
                Price    = price
            };

            ProductOperations.ProductList.Add(productDto);

            //Act
            var product = _productOperations.GetProduct(productId);

            //Assert
            Assert.Equal(productId, product.Id);
        }
예제 #2
0
 public Product GetProduct(int id)
 {
     return(ProductOperations.GetProduct(db, id));
 }