示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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();
        }