public SummaryTests()
        {
            var startDate = new Date(2019, 1, 1);

            _allDays = Enumerable
                       .Range(1, 365)
                       .Select(day => Summary.DailySummary(startDate.AddDays(day - 1), $"What I did on day {day}"));

            _allWeeks = Enumerable
                        .Range(1, 52)
                        .Select(week => Summary.WeeklySummary(startDate.AddDays(7 * (week - 1)), $"What I did in week {week}"));

            _allMonths = Enumerable
                         .Range(1, 12)
                         .Select(month => Summary.MonthlySummary(((Month)startDate).AddMonths(month - 1), $"What I did in month {month}"));
        }
        public static IEnumerable <object[]> SummarizedBy_SpecificSummary_Inputs()
        {
            yield return(new object[] { Summary.DailySummary(new Date(2019, 1, 1), "content"), 0, 0, 0 });

            yield return(new object[] { Summary.WeeklySummary(new Date(2019, 1, 1), "content"), 5, 0, 0 }); // 1st is Tuesday of 2019, so it summarizes all but Sunday and Monday of previous year

            yield return(new object[] { Summary.WeeklySummary(new Date(2019, 2, 1), "content"), 7, 0, 0 });

            yield return(new object[] { Summary.MonthlySummary(new Month(2019, 1), "content"), 0, 5, 0 });

            yield return(new object[] { Summary.WeeklySummary(new Date(2020, 1, 1), "content"), 3, 0, 0 }); // 1st is Wednesday of 2020, so this week contains three days of 2019

            yield return(new object[] { Summary.WeeklySummary(new Date(2020, 2, 1), "content"), 0, 0, 0 });

            yield return(new object[] { Summary.MonthlySummary(new Month(2020, 1), "content"), 0, 0, 0 });
        }
Example #3
0
        static InMemorySummaryService()
        {
            var startDate = new Date(2019, 1, 1);

            Enumerable
            .Range(1, 365)
            .Select(day => Summary.DailySummary(startDate.AddDays(day - 1), $"What I did on day {day}"))
            .ForEach(summary => _store.Add(summary.Id, summary));

            Enumerable
            .Range(1, 52)
            .Select(week => Summary.WeeklySummary(startDate.AddDays(7 * (week - 1)), $"What I did in week {week}"))
            .ForEach(summary => _store.Add(summary.Id, summary));

            Enumerable
            .Range(1, 12)
            .Select(month => Summary.MonthlySummary(((Month)startDate).AddMonths(month - 1), $"What I did in month {month}"))
            .ForEach(summary => _store.Add(summary.Id, summary));
        }
        public void Seed()
        {
            var startDate = new Date(2019, 1, 1);

            Enumerable
            .Range(1, 365)
            .Select(day => Summary.DailySummary(startDate.AddDays(day - 1), $"What I did on day {day}"))
            .Select(summary => summary.ToDbModel())
            .ForEach(summary => _summaries.Insert(summary));

            Enumerable
            .Range(1, 52)
            .Select(week => Summary.WeeklySummary(startDate.AddDays(7 * (week - 1)), $"What I did in week {week}"))
            .Select(summary => summary.ToDbModel())
            .ForEach(summary => _summaries.Insert(summary));

            Enumerable
            .Range(1, 12)
            .Select(month => Summary.MonthlySummary(((Month)startDate).AddMonths(month - 1), $"What I did in month {month}"))
            .Select(summary => summary.ToDbModel())
            .ForEach(summary => _summaries.Insert(summary));
        }
        public DesignSummaries()
        {
            var startDate = new Date(1739, 1, 1);

            var allDays = Enumerable
                          .Range(1, 365)
                          .Select(day => Summary.DailySummary(startDate.AddDays(day - 1), $"What I did on day {day}"))
                          .Select(s => s.ToViewModel(null, null));

            var allWeeks = Enumerable
                           .Range(1, 52)
                           .Select(week => Summary.WeeklySummary(startDate.AddDays(7 * (week - 1)), $"What I did in week {week}"))
                           .Select(s => s.ToViewModel(null, null));

            var allMonths = Enumerable
                            .Range(1, 12)
                            .Select(month => Summary.MonthlySummary(((Month)startDate).AddMonths(month - 1), $"What I did in month {month}"))
                            .Select(s => s.ToViewModel(null, null));

            Summaries            = allMonths;
            EncompassedSummaries = allWeeks;

            Summaries.Skip(1).First().Highlighted = true;
        }