Example #1
0
        public void CheckShortMonth()
        {
            dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
            var shortmonth = DateTime.Now.ToString("MMM");

            Assert.AreEqual(shortmonth, dayForecast.DayForecastCollection.First().ShortMonth);
        }
Example #2
0
        public void CheckDaysHoursMinutesForSingleDay()
        {
            dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
            var singleDay = dayForecast.DayForecastCollection.First();

            Assert.AreEqual(configuration.DefaultHoursInDay, singleDay.TotalHours);
            Assert.AreEqual(configuration.DefaultHoursInDay * 60, singleDay.TotalMinutes);
            Assert.AreEqual((configuration.DefaultHoursInDay * 60) * 60, singleDay.TotalSeconds);
        }
Example #3
0
        public void CheckWeekForCorrectDays()
        {
            dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
            List <string> days = new List <string> {
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
            };
            var daysToCompare = dayForecast.WeekDayForecastCollection.First().Select(tv => tv.FullDayOfTheWeek).ToList();

            CollectionAssert.AreEqual(daysToCompare, days);
        }
 public IEnumerable<string> GetWeek()
 {
     dayforecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), new Models.DayForecastConfiguration
         {
             DayEndOfWeek = "Friday",
             DayStartOfWeek = "Monday",
             DefaultHoursInDay = 8,
             WeekDaysToExclude = new List<string> { "Saturday", "Sunday" }
         }, new DapperRepository<DayForecast>(new SqlConnection(ConfigurationManager.ConnectionStrings["DevForecast"].ConnectionString)));
     return dayforecast.Week;
 }
Example #5
0
 public IEnumerable <string> GetWeek()
 {
     dayforecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), new Models.DayForecastConfiguration
     {
         DayEndOfWeek      = "Friday",
         DayStartOfWeek    = "Monday",
         DefaultHoursInDay = 8,
         WeekDaysToExclude = new List <string> {
             "Saturday", "Sunday"
         }
     }, new DapperRepository <DayForecast>(new SqlConnection(ConfigurationManager.ConnectionStrings["DevForecast"].ConnectionString)));
     return(dayforecast.Week);
 }
Example #6
0
 public void CheckIfDaysAreExcluded()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsFalse(dayForecast.DayForecastCollection.Where(df => df.FullDayOfTheWeek == "Saturday").Any());
     Assert.IsFalse(dayForecast.DayForecastCollection.Where(df => df.FullDayOfTheWeek == "Sunday").Any());
 }
Example #7
0
 public void CheckShortDay()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.AreEqual("Mon", dayForecast.DayForecastCollection.First().ShortDayOfTheWeek);
 }
Example #8
0
 public void CheckMonthDifference()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsTrue(dayForecast.MonthDifference == 6);
 }
Example #9
0
 public void CheckIfForecastCollectionIsNotEmpty()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsTrue(dayForecast.DayForecastCollection.Count > 0);
 }
Example #10
0
 public void CheckTotalDays()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsTrue(dayForecast.TotalDays == dayForecast.DayForecastCollection.Count);
 }
Example #11
0
 public void CheckStartDateDaysInMonth()
 {
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsTrue(dayForecast.StartDaysInMonth == 30);
 }
Example #12
0
 public void CheckWeekSingularDays()
 {
     //need an array of days that only repeats once, sort of like column headings
     dayForecast = new Models.Services.DayForecastService(DateTime.Now, DateTime.Now.AddMonths(6), configuration, dapperRepositoryMock);
     Assert.IsTrue(dayForecast.Week.Any());
 }