Ejemplo n.º 1
0
        public void Submit_Click(object sender, RoutedEventArgs e)
        {
            var    hours   = Convert.ToInt32(HoursComboBox.SelectionBoxItem);
            var    minutes = Convert.ToInt32(MinutesComboBox.SelectionBoxItem);
            string date    = DatePicker.SelectedDate.Value.Date.ToShortDateString();
            var    morning = Convert.ToInt32(MorningSlider.Value);
            var    day     = Convert.ToInt32(DaySlider.Value);

            repo.Add(new SleepEvent(hours, minutes, date, morning, day));
            HoursComboBox.SelectedIndex   = 7;
            MinutesComboBox.SelectedIndex = 0;
            DatePicker.SelectedDate       = DateTime.Today;
            MorningSlider.Value           = 1;
            DaySlider.Value      = 1;
            HoursSum.DataContext = repo.SumHours();
            AvgHours.DataContext = repo.AverageHours();
        }
Ejemplo n.º 2
0
 public void DatabaseAddItem()
 {
     Assert.AreEqual(0, repo.GetCount());
     repo.Add(new SleepEvent(7, 30, "2/15/2015", 7, 8));
     Assert.AreEqual(1, repo.GetCount());
 }