public List <DateTime> GetDaysWithEntries() { var dateTime = new List <DateTime>(); dateTime = dataService.GetDaysWithEntries(dasBlogSettings.GetConfiguredTimeZone()).ToList <DateTime>(); return(dateTime); }
public void GetDaysWithEntries() { List <int> dayNumbers = new List <int>(); IBlogDataService dataService = BlogDataServiceFactory.GetService(createEntries.FullName, null); // this will create an entry for each hour of the day in local time for (int i = 0; i < 24; i++) { Entry entry = TestEntry.CreateEntry(String.Format("Test Entry {0}", i), 5, 2); entry.CreatedUtc = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.AddDays(i).Day, 1, 0, 0).ToUniversalTime(); dayNumbers.Add(DateTime.Now.AddDays(i).Day); i++; dataService.SaveEntry(entry, null); } DateTime[] days = dataService.GetDaysWithEntries(TimeZone.CurrentTimeZone); for (int i = 0; i < 12; i++) { int num = (int)dayNumbers[11 - i]; Assert.AreEqual(num, days[i].Day); i++; } }
public void BlogDataService_GetDaysWithEntries_Successful(IBlogDataService blogdataservice) { var dates = blogdataservice.GetDaysWithEntries(DateTimeZone.Utc).ToList <DateTime>(); Assert.Equal(11, dates.Count); }