Example #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var message = new UserMessage();

            string month = txtMonth.Text;
            string day   = txtDay.Text;
            string year  = txtYear.Text;

            var      ss             = new SearchScheduleDate();
            string   dateString     = ss.FixDateInput(month, day, year);
            var      validReturns   = ss.CheckIfValidDate(dateString);
            bool     validDate      = validReturns.Item1;
            int      daysDifference = validReturns.Item2;
            DateTime dateTime       = validReturns.Item3;

            if (validDate)
            {
                CurrentDayViewed = daysDifference;
                GetScheduledAppointments();

                SetupTextBoxes();

                message.Show($"Your {dateTime.ToShortDateString()} has been searched successfully.");
            }
            else
            {
                message.Show($"Your input of {dateString} is not a valid date.");
            }
        }
Example #2
0
        public void ScheduleSearch_InvalidCheckIfValidDate_ReturnsFalse()
        {
            var  ss            = new SearchScheduleDate();
            var  checkResponse = ss.CheckIfValidDate("13-26-2020");
            bool validDate     = checkResponse.Item1;

            Assert.IsFalse(validDate);
        }