Exemplo n.º 1
0
        public void to_string_returns_formatted_product_by_item_details()
        {
            var productByItem = new ProductByItem {
                ProductName = "Item", Quantity = 2, Price = 3m
            };
            var expected = "Item $6 (2 items at $3 each)";

            Assert.Equal(expected, productByItem.ToString());
        }
Exemplo n.º 2
0
        public void can_create_product_instance_for_price_method_by_item()
        {
            var expected = new ProductByItem {
                ProductName = "Item", Quantity = 2, Price = 3m, PricingMethod = PriceMethodEnum.PerItem
            };
            var actual = ProductFactory.Instance.CreateProductFor(PriceMethodEnum.PerItem, "Item", 3m, 2) as ProductByItem;

            Assert.True(expected.Equals(actual));
        }
Exemplo n.º 3
0
        public void calculates_product_price_as_quantity_times_price()
        {
            var productByItem = new ProductByItem {
                ProductName = "Item", Quantity = 2, Price = 3m
            };
            var expected = 2 * 3;

            Assert.Equal(expected, productByItem.ProductPrice);
        }