Exemple #1
0
 public void AddProductToProductStoragePass()
 {
     Product p = new Product("Testprodukt", 1, "Testdescription", 1.0f, new BoxSize(1, 1, 1), true);
     ProductStorage ps = new ProductStorage();
     ps.AddNewProduct(p);
     Assert.AreEqual(ps.ProductCount(), 1);
 }
Exemple #2
0
 public void RemoveProductFromStoragePass()
 {
     Product p = new Product("Testprodukt", 1, "Testdescription", 1.0, new BoxSize(1, 1, 1), true);
     ProductStorage ps = new ProductStorage();
     ps.AddNewProduct(p);
     ps.RemoveProductID(1);
     Assert.AreEqual(ps.ProductCount(), 0);
 }
Exemple #3
0
        static void Main(string[] args)
        {
            ProductStorage storage = new ProductStorage();
            Controller     c       = new Controller(storage);

            do
            {
                c.ShowMenu();
            } while (Console.ReadKey().Key != ConsoleKey.Escape);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            ProductStorage storage = new ProductStorage();
            Controller c = new Controller(storage);

            do
            {
                c.ShowMenu();
            } while (Console.ReadKey().Key != ConsoleKey.Escape);
        }
Exemple #5
0
        public void SortProductsByNamePass()
        {
            ProductStorage ps = new ProductStorage();
            Product p1 = new Product("Testprodukt", 1, "Testdescription", 1.0f, new BoxSize(1, 1, 1), true);
            Product p2 = new Product("ABC produkt", 1, "Testdescription", 1.0f, new BoxSize(1, 1, 1), true);
            ps.AddNewProduct(p1);
            ps.AddNewProduct(p2);

            List<Product> sortedlist = ps.ProductsSortedByName();
            Assert.AreEqual(sortedlist[0].ProductName, "ABC produkt");
        }
Exemple #6
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;
                product.ProductDescription = "Generic product description";



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

            Console.WriteLine("Thank you Sir or Madame!");


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

            storage.RemoveProductID(ID);


            var prodlist = storage.ProductsSortedByName();

            foreach (var item in prodlist)
            {
                Console.WriteLine(item.ProductName);
            }
            while (Console.ReadKey().Key != ConsoleKey.Escape)
            {
                ;
            }
        }
Exemple #7
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;
                product.ProductDescription = "Generic product description";

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

            Console.WriteLine("Thank you Sir or Madame!");

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

            var prodlist = storage.ProductsSortedByName();
            foreach (var item in prodlist)
            {
                Console.WriteLine(item.ProductName);
            }
            while (Console.ReadKey().Key != ConsoleKey.Escape);
        }
Exemple #8
0
 public Controller(ProductStorage pstorage)
 {
     storage = pstorage;
 }
Exemple #9
0
 public Controller(ProductStorage pstorage)
 {
     storage = pstorage;
 }