コード例 #1
0
        public void TestToDateTimeConverter()
        {
            var etDateTime    = new EthiopianDateTime(1585731446021); // 2012-07-23 08:57:26.021
            var expectedYear  = 2020;
            var expectedMonth = 4;
            var expectedDay   = 1;

            var convertedDate = etDateTime.ToDateTime();

            Assert.Equal(convertedDate.Year, expectedYear);
            Assert.Equal(convertedDate.Month, expectedMonth);
            Assert.Equal(convertedDate.Day, expectedDay);
        }
コード例 #2
0
        public void TestParameterLessEtDateTime()
        {
            EthiopianDateTime paramLessData   = new EthiopianDateTime();
            EthiopianDateTime currentDateTime = new EthiopianDateTime((long)DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds);

            Assert.Equal(paramLessData.Year, currentDateTime.Year);
            Assert.Equal(paramLessData.Month, currentDateTime.Month);
            Assert.Equal(paramLessData.Day, currentDateTime.Day);
            Assert.Equal(paramLessData.DayGeez, currentDateTime.DayGeez);
            Assert.Equal(paramLessData.Hour, currentDateTime.Hour);
            Assert.Equal(paramLessData.Minute, currentDateTime.Minute);
            Assert.Equal(paramLessData.MonthGeezName, currentDateTime.MonthGeezName);
        }
コード例 #3
0
        public void TestUnixParamEtDateTime()
        {
            var dateTime = new EthiopianDateTime(1585731446021);

            var expectedDateString = "2012-07-23 08:57:26.021";
            var expectedYear       = 2012;
            var expectedMonth      = 7;
            var expectedDay        = 23;
            var expectedDayGeez    = "፳፫";
            var expectedHour       = 8;
            var expectedMinute     = 57;
            var expectedSecond     = 26;

            Assert.Equal(dateTime.Year, expectedYear);
            Assert.Equal(dateTime.ToString(), expectedDateString);
            Assert.Equal(dateTime.Month, expectedMonth);
            Assert.Equal(dateTime.Day, expectedDay);
            Assert.Equal(dateTime.DayGeez, expectedDayGeez);
            Assert.Equal(dateTime.Hour, expectedHour);
            Assert.Equal(dateTime.Minute, expectedMinute);
            Assert.Equal(dateTime.Second, expectedSecond);
        }
コード例 #4
0
        public void TestDateTimeParam()
        {
            var etDateTime = new EthiopianDateTime(DateTime.Now);

            Assert.True(etDateTime.Year.Equals(2012));
        }