コード例 #1
0
        public void MaxTest()
        {
            Calendar.NET.Calendar c = new Calendar.NET.Calendar();
            int i = c.Max(30, 31, 33, 32) + 5;

            Assert.AreEqual(i, 38);
        }
コード例 #2
0
        public void NumberOfWeeksTest()
        {
            Calendar.NET.Calendar c = new Calendar.NET.Calendar();
            int weeks = c.NumberOfWeeks(2017, 5);

            Assert.AreEqual(weeks, 5);
        }
コード例 #3
0
        public void LastDayOfWeekInMonthTest()
        {
            Calendar.NET.Calendar c = new Calendar.NET.Calendar();
            DateTime d = new DateTime(2017, 5, 1); //1st May 2017

            Assert.AreEqual(c.LastDayOfWeekInMonth(d, d.DayOfWeek), DateTime.Parse("5/29/2017 12:00:00 AM"));
        }
コード例 #4
0
 public void GetFinalBackColorTest()
 {
     Calendar.NET.Calendar c = new Calendar.NET.Calendar();
     c.BackColor = Color.White;
     c.GetFinalBackColor();
     Assert.AreEqual(c.BackColor, Color.White);
 }
コード例 #5
0
        public void PresetHolidaysTest()
        {
            Calendar.NET.Calendar c = new Calendar.NET.Calendar();
            c.GetEvents().Clear();
            c.PresetHolidays();
            List <IEvent> events = c.GetEvents();

            Assert.AreEqual(events[0].EventText, "April Fools Day");
        }
コード例 #6
0
        private void Doc_PrintPage(object sender, PrintPageEventArgs e)
        {
            Size s = calendar1.Size;

            Calendar.NET.Calendar current = calendar1;
            double rate = current.Width / 600;

            current.Width  = 600;
            current.Height = Convert.ToInt32(current.Height / rate);
            float  x   = e.MarginBounds.Left;
            float  y   = e.MarginBounds.Top;
            Bitmap bmp = new Bitmap(current.Width, current.Height);

            current.DrawToBitmap(bmp, new Rectangle(0, 0, current.Width, current.Height));
            e.Graphics.DrawImage((Image)bmp, x, y);
            calendar1.Size = s;
        }
コード例 #7
0
        public void AddEventTest()
        {
            Calendar.NET.Calendar c = new Calendar.NET.Calendar();
            c.GetEvents().Clear();
            var exerciseEvent = new CustomEvent
            {
                StartDate          = DateTime.Now,
                EndDate            = DateTime.Now,
                RecurringFrequency = RecurringFrequencies.Monthly,
                EventLengthInHours = 1,
                Alert     = 1,
                EventText = "event1",
                EventFont = new Font(FontFamily.GenericSansSerif, 12.0f, FontStyle.Regular)
            };

            c.AddEvent(exerciseEvent, false);
            Assert.AreEqual(c.GetEvents().Count, 1);
        }
コード例 #8
0
 public void CalendarInitTest()
 {
     Calendar.NET.Calendar c = new Calendar.NET.Calendar();
     Assert.AreEqual(c.CalendarView, CalendarViews.Month);
 }