예제 #1
0
        private async void OnPreviousMonthClick(object sender, EventArgs e)
        {
            var result = await Task.Run(() =>
            {
                _monthContainer.Previous();

                var days      = _monthContainer.Days;
                var monthName = _monthContainer.GetName();

                return(days, monthName);
            });

            MonthName.Text = result.monthName;
            RecycleDays(result.days);
        }
예제 #2
0
        public CalendarView()
        {
            InitializeComponent();

            _monthContainer = new MonthContainer(DateTime.Today);
            BindableLayout.SetItemsSource(CalendarDaysContainer, _monthContainer.Days);
            BindableLayout.SetItemsSource(CalendarDaysOfWeekContainer, _monthContainer.DaysOfWeek);
            MonthName.Text = _monthContainer.GetName();
        }
예제 #3
0
        public void MonthContainerShouldHaveAName()
        {
            var dateTime = new DateTime(2020, 7, 9);
            var monthContainer = new MonthContainer(dateTime);

            var result = monthContainer.GetName();
            var dateTimeName = dateTime.ToString("MMMM yyyy");
            Assert.AreEqual(dateTimeName, result);
        }
예제 #4
0
        public void MonthContainerShouldNavigateToNextMonth()
        {
            var dateTime = new DateTime(2020, 11, 9);
            var monthContainer = new MonthContainer(dateTime);

            monthContainer.Next();

            var dateTimeName = monthContainer._month.MonthDateTime.ToString("MMMM yyyy");
            Assert.AreEqual(dateTimeName, monthContainer.GetName());
            Assert.AreEqual(31, monthContainer.Days.Count(day => day is {}));
예제 #5
0
        public void MonthContainerShouldNavigateToPreviousMonth()
        {
            var dateTime       = new DateTime(2021, 1, 1);
            var monthContainer = new MonthContainer(dateTime);

            monthContainer.Previous();

            var dateTimeName = monthContainer._month.MonthDateTime.ToString("MMMM");

            Assert.AreEqual(dateTimeName, monthContainer.GetName());
        }
예제 #6
0
        public void MonthContainerShouldNavigateToNextMonth()
        {
            var dateTime       = new DateTime(2020, 12, 9);
            var monthContainer = new MonthContainer(dateTime);

            monthContainer.Next();

            var dateTimeName = monthContainer._month.MonthDateTime.ToString("MMMM");

            Assert.AreEqual(dateTimeName, monthContainer.GetName());
        }