コード例 #1
0
        public void AddEventTest3()
        {
            DateTime Date;

            Date = DateTime.Parse("16.02.1999 00:00:00");
            EventModel model    = new EventModel(Date, "TestEvent3");
            AddEvent   newEvent = new AddEvent();

            newEvent.Add(model, connection);

            var cmdText = $"SELECT * FROM EVENTS WHERE [DateOfEvent] = @dateOfEvent " +
                          $"AND [Event] = '{model.Event}'";

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

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

            if (TestCommand.ExecuteReader().HasRows)
            {
                connection.Close();
                Assert.Pass();
            }
            else
            {
                connection.Close();
                Assert.Fail("В таблице нет записи");
            }
        }
コード例 #2
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     if (AddSheduleText.Text != "" && AddSheduleText.Text != null && AddSheduleText.Text.Length != 0)
     {
         AddEvent addEvent = new AddEvent();
         addEvent.Add(AddSheduleText.Text, AddSheduleDate.Value);
         UpdateViews();
     }
 }
コード例 #3
0
        public void Setup()
        {
            connection.Open();
            OleDbCommand TruncateCommand = new OleDbCommand("DELETE FROM Events", connection);

            TruncateCommand.ExecuteNonQuery();
            connection.Close();
            AddEvent   @event = new AddEvent();
            EventModel model;
            DateTime   date = DateTime.Today;

            for (int Item = 0; Item < 100; Item++)
            {
                model = new EventModel(date, $"TestEvent № {Item}");
                @event.Add(model, connection);
            }
        }