Exemple #1
0
        public void InventoryCalculateInventoryValueEqualsExpectedResults()
        {
            var inventory = new Models.Inventory();

              //Add 4 products to inventory
              for (int i = 0; i < 4; i++)
            inventory.Add(new Product { Id = i, Quantity = 5, Price=10*i });

              //Compare each product's inventory value to expected result
              for (int i = 0; i < 4; i++)
              {
            Assert.AreEqual(5 * 10 * i, inventory.ProductValue(i));
              }
        }
Exemple #2
0
        public void InventoryCalculateInventoryValueEqualsExpectedResults()
        {
            var inventory = new Models.Inventory();

            //Add 4 products to inventory
            for (int i = 0; i < 4; i++)
            {
                inventory.Add(new Product {
                    Id = i, Quantity = 5, Price = 10 * i
                });
            }

            //Compare each product's inventory value to expected result
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(5 * 10 * i, inventory.ProductValue(i));
            }
        }
Exemple #3
0
        public void InventoryAddSubtractQuantityEqualsExpectedResults()
        {
            var inventory = new Models.Inventory();

              //Add 4 products to inventory
              for (int i = 0; i < 4; i++)
            inventory.Add(new Product { Id = i, Quantity = 5 });

              //Add to each product's quantity
              for (int i = 0; i < 4; i++)
            inventory.AddQuantity(i, i);

              //Compare added quantity with expected result
              for (int i = 0; i < 4; i++)
            Assert.AreEqual(5 + i, inventory.Product(i).Quantity);

              //Subtract to each product's quantity
              for (int i = 0; i < 4; i++)
            inventory.AddQuantity(i, -i);

              //Compare subtracted quantity with expected result
              for (int i = 0; i < 4; i++)
            Assert.AreEqual(5, inventory.Product(i).Quantity);
        }
Exemple #4
0
        public void InventoryAddSubtractQuantityEqualsExpectedResults()
        {
            var inventory = new Models.Inventory();

            //Add 4 products to inventory
            for (int i = 0; i < 4; i++)
            {
                inventory.Add(new Product {
                    Id = i, Quantity = 5
                });
            }

            //Add to each product's quantity
            for (int i = 0; i < 4; i++)
            {
                inventory.AddQuantity(i, i);
            }

            //Compare added quantity with expected result
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(5 + i, inventory.Product(i).Quantity);
            }

            //Subtract to each product's quantity
            for (int i = 0; i < 4; i++)
            {
                inventory.AddQuantity(i, -i);
            }

            //Compare subtracted quantity with expected result
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(5, inventory.Product(i).Quantity);
            }
        }