PageRenderTime 40ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Samples/Blog/Bifrost.Samples.Blog.Views.Specs/Posts/for_PostStatisticsService/when_updating_the_statistics.cs

#
C# | 31 lines | 26 code | 5 blank | 0 comment | 1 complexity | acaeb52d153cd382bde3cdb51a4aaa14 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using System.Linq;
  3. using Bifrost.Samples.Blog.Views.Posts;
  4. using Bifrost.Time;
  5. using Machine.Specifications;
  6. namespace Bifrost.Samples.Blog.Views.Specs.Posts.for_PostStatisticsService
  7. {
  8. public class when_updating_the_statistics_with_a_new_post : given.five_posts_for_january_2011
  9. {
  10. static PostsByYear postsByYear;
  11. Because of = () =>
  12. {
  13. post_statistics_service.AggregateForMonth(year, month, Guid.NewGuid());
  14. postsByYear = posts_by_year_entity_context.Entities.First();
  15. };
  16. It should_update_the_posts_in_january_2011_to_6 = () =>
  17. {
  18. posts_by_year_entity_context.Entities.Count().ShouldEqual(1);
  19. postsByYear.January.ShouldEqual(6);
  20. foreach (var post in postsByYear.Counts.Where(c => c.Key != Month.January))
  21. {
  22. post.Value.ShouldEqual(0);
  23. }
  24. };
  25. }
  26. }