Exemple #1
0
        public void Index()
        {
            GymController controller = new GymController();
            ViewResult    result     = controller.Index as ViewResult;

            Assert.IsNotNull(result);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            rand = new Random(DateTime.Now.Millisecond);
            Console.CursorVisible = false;

            Equipment[] equipments = new Equipment[4];
            equipments[0] = new Bar();
            equipments[1] = new BasketballBall();
            equipments[2] = new Bench();
            equipments[3] = new Mat();

            Table barTable = new Table(equipments[0]);

            barTable.GetTableDataFrom(equipments[0]);
            barTable.GetTableDataFrom(new Bar());
            barTable.GetTableDataFrom(new Bar());
            Console.WriteLine(barTable);

            Table basketballTable = new Table(equipments[1]);

            basketballTable.GetTableDataFrom(equipments[1]);
            basketballTable.GetTableDataFrom(new BasketballBall());
            basketballTable.GetTableDataFrom(new BasketballBall());
            basketballTable.ToString().WriteFromPosition((Console.WindowWidth / 2, 0));

            Table benchTable = new Table(equipments[2]);

            benchTable.GetTableDataFrom(equipments[2]);
            benchTable.GetTableDataFrom(new Bench());
            benchTable.GetTableDataFrom(new Bench());
            benchTable.ToString().WriteFromPosition((Console.WindowWidth / 2, Console.WindowHeight / 2));

            Table matTable = new Table(equipments[3]);

            matTable.GetTableDataFrom(equipments[3]);
            matTable.GetTableDataFrom(new Mat());
            matTable.GetTableDataFrom(new Mat());
            matTable.ToString().WriteFromPosition((0, Console.WindowHeight / 2));

            equipments[0].DoSomething();
            equipments[1].DoSomething();
            equipments[2].DoSomething();
            equipments[3].DoSomething();
            "Press any button to continue...".ToLog();
            Console.ReadKey();

            IBall ball = equipments[1] as BasketballBall;

            ball.DoKick();

            Printer printer = new Printer();

            foreach (var equipment in equipments)
            {
                printer.IAmPrinting(equipment);
            }

            "Press any button to continue...".ToLog();
            Console.ReadKey();

            (equipments[1] as BasketballBall).DoSomething();
            (equipments[1] as IBall).DoSomething();

            Console.ReadKey();
            Console.Clear();

            Gym gym = new Gym(400);

            while (gym.HasMoney)
            {
                Equipment eq = new BasketballBall();
                gym.AddItem(eq);
            }
            Console.WriteLine(gym.ToString());
            GymController gymc = new GymController(gym);

            gymc.Sort();
            Console.WriteLine(gym.ToString());
            Console.WriteLine("\tEnter cost range:");
            List <Equipment> founded = gymc.Find(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()));

            Console.WriteLine($"\tResult [{founded.Count}]:");
            foreach (var item in founded)
            {
                Console.WriteLine(item.ToString());
            }
            Console.ReadKey();
        }