static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Component hdd1 = new Component("HDD", "Seagate 2 TB", 230);
            Component ram1 = new Component("RAM","Crossair 8 GB", 140);
            Component gpu1 = new Component("GPU","GTX TitanZ", 1980);
            Component cpu1 = new Component("CPU", "Intel Core i7-6700", 655);
            Component cddrive1 = new Component("DVD", 45);

            Component hdd2 = new Component("HDD", "Toshiba 500 GB", 70);
            Component ram2 = new Component("RAM", "Value 4 GB", 74);
            Component gpu2 = new Component("GPU", "Sapphire HD8750", 430);
            Component cpu2 = new Component("CPU", "AMD Buldozer A9950", 400);

            List<Computer> computers = new List<Computer>
                {
                    new Computer("Nai-moshtniq", hdd1, ram1, gpu1, cpu1, cddrive1),
                    new Computer("Sreden klas", hdd2, ram2, gpu2, cpu2),
                    new Computer("Melez", hdd2, ram2, gpu1, cpu2),
                    new Computer("Mnogo moshten", hdd2, ram1, gpu1, cpu1),
                    new Computer("Leko moshten", hdd2, ram2, gpu1, cpu1)
                };

            var sortedComputers = computers.OrderBy(x => x.Price);

            foreach (var computer in sortedComputers)
            {
                Console.WriteLine(computer);
                Console.WriteLine();
            }
        }
        public void CompareToMethod_CorrectlyComparesComponents()
        {
            // arrange
            var component1 = new Component("RAM", 45.50m, "8 GB");
            var component2 = new Component("Motherboard", 90);
            var expected = component1.Price.CompareTo(component2.Price);

            // assert - if equal, the components have indeed been compared by price
            var actual = component1.CompareTo(component2);
            Assert.AreEqual(expected, actual, "Components were not correctly compared.");
        }
        static void Main(string[] args)
        {
            List<Component> parts = new List<Component>();
            Component part1 = new Component("Hdd", "250 gb", 100m);
            Component part2 = new Component("MB", "Foxcon", 100m);
            Component part3 = new Component("PSU", 100m);
            parts.Add(part1);
            parts.Add(part2);
            parts.Add(part3);

            Computer comp1 = new Computer("Super Comp", parts);
            Console.WriteLine(comp1.ToString());
        }
        static List<Component> AddComponents()
        {
            List<Component> components = new List<Component>();
            string ch = null;

            do
            {
                Console.Write("Enter component name: ");
                string name = Console.ReadLine();
                Console.Write("Enter component description (not mandatory): ");
                string desc = Console.ReadLine();
                Console.Write("Enter component price: ");
                double price = Double.Parse(Console.ReadLine());

                Component component = new Component(name, price, desc);
                components.Add(component);

                Console.Write("\nAdd another component (y/n)? ");
                ch = Console.ReadLine();
            }
            while (ch != "n" && ch != "N");

            return components;
        }
 public void AddComponent(Component component)
 {
     var list = this.Components;
     list.Add(component);
     this.Components = list;
 }