Example #1
0
        public void TestRange(int year, int month, int day, int location, int length, NSCalendarUnit smaller, NSCalendarUnit larger)
        {
            var cal  = new NSCalendar(NSCalendarType.Gregorian);
            var date = new DateTime(year, month, day);

            date = DateTime.SpecifyKind(date, DateTimeKind.Utc);
            var range = cal.Range(smaller, larger, (NSDate)date);

            Assert.AreEqual(location, range.Location);
            Assert.AreEqual(length, range.Length);
        }
Example #2
0
        public void TestRangeOrUnitIntervalNotNull(int year, int month, int day, NSCalendarUnit unit, double expectedInterval)
        {
            var cal  = new NSCalendar(NSCalendarType.Gregorian);
            var date = new DateTime(year, month, day);

            date = DateTime.SpecifyKind(date, DateTimeKind.Utc);
            var    outDate = (NSDate)DateTime.Now;
            double outInterval;
            var    success = cal.Range(unit, out outDate, out outInterval, (NSDate)date);

            Assert.AreEqual(expectedInterval, outInterval);
        }