public void AddTest()
        {
            var userName     = Guid.NewGuid().ToString();
            var activityName = Guid.NewGuid().ToString();
            var rnd          = new Random();

            var userController     = new UserController(userName);
            var exerciesController = new  ExerciesController(userController.CurrentUser);

            var activity = new Activity(activityName, rnd.Next(10, 50));


            exerciesController.Add(activity, DateTime.Now, DateTime.Now.AddHours(1));

            Assert.AreEqual(activity.Name, exerciesController.Activity.First().Name);
        }
Ejemplo n.º 2
0
        private static void TestingInterfaceApp()
        {
            var culture         = CultureInfo.CreateSpecificCulture(RU_LANGUAGE);
            var resourceManager = new ResourceManager(_RU_LANGUAGE, typeof(Start).Assembly);

            Console.WriteLine($"{resourceManager.GetString("Greeting", culture)}\n");

            Console.Write("►Введите имя пользователя: ");
            string name = Console.ReadLine();

            var userController     = new UserController(name);
            var eatingController   = new EatingController(userController.CurrentUser);
            var exerciesController = new ExerciesController(userController.CurrentUser);

            if (userController.IsNewUser)
            {
                Console.Write("►Введите пол: ");

                var gender = Console.ReadLine();

                var birthDay = ParsDateTime("дата рожнения");
                var weight   = ParseDouble("вес");
                var heigth   = ParseDouble("рост");

                userController.SetNewUserData(gender, birthDay, weight, heigth);
            }

            Console.WriteLine(userController.CurrentUser);

            while (true)
            {
                Console.WriteLine("Что вы хотите сделать?");
                Console.WriteLine("E - ввести приём пищи");
                Console.WriteLine("A - ввести упражнения");
                Console.WriteLine("Q - выход");

                var key = Console.ReadKey();

                Console.WriteLine();

                switch (key.Key)
                {
                case ConsoleKey.E:
                    var foods = EnterEating();
                    eatingController.Add(foods.Food, foods.Weight);

                    foreach (var item in eatingController.Eatings.Foods)
                    {
                        Console.WriteLine($"\n{item.Key} - {item.Value}");
                    }
                    break;

                case ConsoleKey.A:
                    var exe = EnterExercies();
                    //  var exercise = new Exercies(exe.Begin, exe.End, exe.Activity, userController.CurrentUser);
                    exerciesController.Add(exe.Activity, exe.Begin, exe.End);

                    foreach (var item in exerciesController.Exercises)
                    {
                        Console.WriteLine($"\n{item.Activity} с {item.Start.ToShortTimeString()} до {item.Finish.ToShortTimeString()}");
                    }

                    break;

                case ConsoleKey.Q:
                    Environment.Exit(0);
                    break;
                }

                Console.ReadLine();
            }
        }