コード例 #1
0
        static void Main(string[] args)
        {
            ProductStorage storage = new ProductStorage();

            //Add a product

            do
            {
                Console.WriteLine("Time to create an object. Please enter the following information.");
                Console.Write("ProductName:");
                string name = Console.ReadLine();
                Console.Write("ProductID");
                int id = Int32.Parse(Console.ReadLine());

                Product product = new Product();
                product.ProductName = name;
                product.ProductID   = id;
                //..


                storage.AddNewProduct(product);
                Console.WriteLine("Product added.");
                Console.WriteLine("Enter esc to quit");
            } while (Console.ReadKey().Key != ConsoleKey.Escape);

            Console.Write("Enter ProductID to remove:");
            int ID = Int32.Parse(Console.ReadLine());

            storage.RemoveProductID(ID);

            Console.WriteLine("Thank you sir!");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Gedoc2005/Product
        static void Main(string[] args)
        {
            ProductStorage storage = new ProductStorage();
            //Add a product

            do
            {
                Console.WriteLine("Time to create an object. Please enter the following information.");
                Console.Write("ProductName:");
                string name = Console.ReadLine();
                Console.Write("ProductID");
                int id = Int32.Parse(Console.ReadLine());

                Product product = new Product();
                product.ProductName = name;
                product.ProductID = id;
                //..

                storage.AddNewProduct(product);
                Console.WriteLine("Product added.");
                Console.WriteLine("Enter esc to quit");

            } while (Console.ReadKey().Key != ConsoleKey.Escape);

            Console.Write("Enter ProductID to remove:");
            int ID = Int32.Parse(Console.ReadLine());
            storage.RemoveProductID(ID);

            Console.WriteLine("Thank you sir!");
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: Gedoc2005/Product
        public void AddProductToProductStoragePass()
        {
            Product p = new Product("Testprodukt", 1, "Testdescription", 1.0, new BoxSize(1, 1, 1), true);
            ProductStorage ps = new ProductStorage();
            ps.AddNewProduct(p);

            Assert.AreEqual(ps.ProductCount(), 1);
        }