Пример #1
0
        public void TestAddProduct()
        {
            // Arrange
            Product product = new Product()
            {
                ProductID   = "1234567890123",
                Name        = "Test Product",
                Category    = "Test Category",
                Brand       = "Test Brand",
                ItemID      = 100000,
                Price       = 1.0M,
                Taxable     = true,
                Type        = "Test Type",
                Description = "Test product description."
            };
            int expected = 1;

            // Act
            int actual = _productAccessor.InsertProduct(product);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Creator: Robert Holmes
        /// Created: 2020/03/17
        /// Approver: Jaeho Kim
        ///
        /// Add a new product to the database.
        /// </summary>
        /// <remarks>
        /// Updater:
        /// Updated:
        /// Update:
        ///
        /// </remarks>
        /// <param name="product">Product to add</param>
        /// <returns></returns>
        public bool AddProduct(Product product)
        {
            bool success = false;

            try
            {
                success = (1 == _productAccessor.InsertProduct(product));
            }
            catch (Exception)
            {
                throw;
            }
            return(success);
        }