示例#1
0
        public void ConvertToNames_for_Monthly_periods()
        {
            var currentDate = new DateTime(2015, 4, 9);
            var expected    = new[]
            {
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-8)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-7)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-6)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-5)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-4)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-3)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-2)),
                PeriodsHelper.GetMonthName(currentDate.AddMonths(-1)),
                PeriodsHelper.GetMonthName(currentDate)
            };
            var periods = PeriodsHelper.GetPeriods(currentDate, TimelogsPeriod.Monthly, 9);
            var actual  = periods.ConvertToNames(TimelogsPeriod.Monthly, DateTime.Now);

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
示例#2
0
        public void GetMonthName_should_return_monthAbbr_andYear()
        {
            var actual = PeriodsHelper.GetMonthName(new DateTime(2015, 4, 9));

            Assert.AreEqual("Apr,15", actual);
        }