Example #1
0
        public void ConstructorSetsProperties()
        {
            //act
            VeblenGood product = new VeblenGood("p4", "Rolex watch", 700);

            //assert
            Assert.Equal("p4", product.Id);
            Assert.Equal("Rolex watch", product.Name);
            Assert.Equal(700, product.CostPrice);
        }
Example #2
0
        public void RetailPriceShouldBe4TimesCostPrice()
        {
            //arrange
            VeblenGood product = new VeblenGood();

            product.CostPrice = 10;
            //act
            double retailPrice = product.RetailPrice;

            //assert
            Assert.Equal(product.CostPrice * 4, product.RetailPrice);
        }
Example #3
0
        public void ShouldStoreAndRerieveVeblenGood()
        {
            //arrange
            VeblenGood product = new VeblenGood
            {
                Id        = "v1",
                Name      = "Rolex watch",
                CostPrice = 700
            };

            //act
            sut.Create(product);
            Product retrievedProduct = sut.SelectById("v1");

            //assert
            Assert.IsType(typeof(VeblenGood), retrievedProduct);
        }
Example #4
0
        public static void Main()
        {
            Product product1 = new NormalGood
            {
                Id        = "p1",
                Name      = "Dog Dinner",
                CostPrice = 0.4
            };
            Product product2 = new NormalGood
            {
                Id        = "p2",
                Name      = "Fork",
                CostPrice = 0.4
            };
            Product product3 = new VeblenGood
            {
                Id        = "p3",
                Name      = "Krug Champagne",
                CostPrice = 25
            };
            Product product4 = new VeblenGood
            {
                Id        = "p4",
                Name      = "Rolex watch",
                CostPrice = 700
            };

            Product[] products = new Product[4];
            products[0] = product1;
            products[1] = product2;
            products[2] = product3;
            products[3] = product4;

            foreach (Product product in products)
            {
                Console.WriteLine($"{product.Name} Cost Price {product.CostPrice} Retail Price {product.RetailPrice}");
            }

            Console.ReadKey();
        }