PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 5ms 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
 1using System;
 2using System.Linq;
 3using Bifrost.Samples.Blog.Views.Posts;
 4using Bifrost.Time;
 5using Machine.Specifications;
 6
 7namespace Bifrost.Samples.Blog.Views.Specs.Posts.for_PostStatisticsService
 8{
 9    public class when_updating_the_statistics_with_a_new_post : given.five_posts_for_january_2011
10    {
11        static PostsByYear postsByYear;
12
13        Because of = () =>
14                         {
15                             post_statistics_service.AggregateForMonth(year, month, Guid.NewGuid());
16                             postsByYear = posts_by_year_entity_context.Entities.First();
17                         };
18
19        It should_update_the_posts_in_january_2011_to_6 = () =>
20                                                              {
21                                                                  posts_by_year_entity_context.Entities.Count().ShouldEqual(1);
22                                                                  postsByYear.January.ShouldEqual(6);
23                                                                  foreach (var post in postsByYear.Counts.Where(c => c.Key != Month.January))
24                                                                  {
25                                                                      post.Value.ShouldEqual(0);
26                                                                  }
27                                                              };
28
29
30    }
31}