Esempio n. 1
0
        public void AddTaskTest3()
        {
            DateTime date;

            date = DateTime.Parse("16.02.1999 00:00:00");
            TasksModel model   = new TasksModel("TestTask3", date, 0);
            AddTask    newTask = new AddTask();

            newTask.Add(model, connection);

            var cmdText = $"SELECT * FROM Tasks WHERE [End_Date] = @EndDate " +
                          $"AND [Task] = '{model.Task}' " +
                          $"AND [Preority] = {model.Preority}";

            connection.Open();
            OleDbCommand TestCommand = new OleDbCommand(cmdText, connection);

            TestCommand.Parameters.Add(new OleDbParameter("@EndDate", OleDbType.Date));
            TestCommand.Parameters["@EndDate"].Value = model.EndDate;

            if (TestCommand.ExecuteReader().HasRows)
            {
                connection.Close();
                Assert.Pass();
            }
            else
            {
                connection.Close();
                Assert.Fail("В таблице нет записи");
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            List <TaskModel> tasksModel = new List <TaskModel>();
            string           comment    = "";

            ConsoleEx.WriteLine("Witam w Managerze Zadań ToDo".PadRight(50, '>').PadLeft(60, '<'), ConsoleColor.Red); //poprawic padleft i right
            ConsoleEx.WriteLine("W razie pomocy wpisz komendę HELP".PadRight(50, '>').PadLeft(60, '<'), ConsoleColor.Blue);
            do
            {
                ConsoleEx.Write("Wpisz komendę: ", ConsoleColor.Blue);

                comment = Console.ReadLine().ToLower();
                if (Enum.GetNames(typeof(Comments)).Contains(comment))
                {
                    if (comment == Comments.help.ToString())
                    {
                        ConsoleEx.Write("Lista dostępnych komend: ", ConsoleColor.Blue);
                        ConsoleEx.WriteLine(string.Join("; ", Enum.GetNames(typeof(Comments))), ConsoleColor.Yellow);
                    }
                    if (comment == Comments.add.ToString())
                    {
                        AddTask.Add(tasksModel);
                    }
                    if (comment == Comments.clear.ToString())
                    {
                        Console.Clear();
                    }
                    if (comment == Comments.remove.ToString())
                    {
                        RemoveTask.Delete(tasksModel);
                    }
                    if (comment == Comments.load.ToString())
                    {
                        LoaderTasks.Load(tasksModel);
                    }
                    if (comment == Comments.save.ToString())
                    {
                        SaveTasks.Save(tasksModel);
                    }
                    if (comment == Comments.show.ToString())
                    {
                        Show.ShowAll(tasksModel);
                    }
                    Console.WriteLine("hej");
                }
                else
                {
                    Console.WriteLine("Wpisałeś złą komendę");
                }
            } while (comment != "exit");
        }
Esempio n. 3
0
        public void Setup()
        {
            connection.Open();
            OleDbCommand TruncateCommand = new OleDbCommand("DELETE FROM Tasks", connection);

            TruncateCommand.ExecuteNonQuery();
            connection.Close();
            DateTime date;

            date = DateTime.Today;
            TasksModel model;
            AddTask    newTask = new AddTask();

            for (int Item = 0; Item < 100; Item++)
            {
                model = new TasksModel($"TestTask №{Item}", date, Item);
                newTask.Add(model, connection);
            }
        }