System.Globalization.PersianCalendar.GetEra C# (CSharp) Method

GetEra() public method

public GetEra ( System.DateTime time ) : int
time System.DateTime
return int
        public override int GetEra(DateTime time) {
            CheckTicksRange(time.Ticks);
            return (PersianEra);
        }

Usage Example

Esempio n. 1
0
        public void CheckTicksRange_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
#if _NET_3_5
                PPersianCalendar.CheckTicksRangeInt64().Body = (@this, ticks) => { };
#else
                PPersianCalendar.CheckTicksRangeInt64().Body = ticks => { };
#endif

                // Act
                var calendar = new PersianCalendar();
                var actual = calendar.GetEra(new DateTime(622, 3, 20));

                // Assert
                Assert.AreEqual(PersianCalendar.PersianEra, actual);
            }
        }