Пример #1
0
        public static RoomQueue ReadRooms(string path)
        {
            var roomQueue  = new RoomQueue();
            var allFolders = Directory.GetDirectories(path);

            foreach (var folder in allFolders)
            {
                roomQueue.Push(new Room()
                {
                    Num       = folder.Split('\\').Last(),
                    Computers = ReadComputerList(folder)
                });
            }
            return(roomQueue);
        }
Пример #2
0
        static void TestRooms()
        {
            var list1  = new ComputerList();
            var comp11 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 1
            };
            var comp21 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 2
            };
            var comp31 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 3
            };
            var comp41 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 4
            };

            list1.Push(comp11);
            list1.Push(comp21);
            list1.Push(comp31);
            list1.Push(comp41);

            var list2  = new ComputerList();
            var comp12 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 1
            };
            var comp22 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 2
            };
            var comp32 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 3
            };
            var comp42 = new Computer()
            {
                Id = Guid.NewGuid(), Price = 4
            };

            list1.Push(comp12);
            list1.Push(comp22);
            list1.Push(comp32);
            list1.Push(comp42);

            var queue = new RoomQueue();

            queue.Push(new Room()
            {
                Num       = "a1",
                Computers = list1
            });
            queue.Push(new Room()
            {
                Num       = "b1",
                Computers = list2
            });


            foreach (var item in queue)
            {
                Console.WriteLine(((Room)item).Num);
            }
        }