/Source/Samples/Blog/Bifrost.Samples.Blog.Views.Specs/Posts/for_PostStatisticsService/when_updating_the_statistics_with_an_existing_post.cs
C# | 31 lines | 28 code | 3 blank | 0 comment | 1 complexity | 08b42aad6d6352cb266ccb1be6c9eb65 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
- using System;
- using System.Linq;
- using Bifrost.Samples.Blog.Views.Posts;
- using Bifrost.Time;
- using Machine.Specifications;
-
- namespace Bifrost.Samples.Blog.Views.Specs.Posts.for_PostStatisticsService
- {
- public class when_updating_the_statistics_with_an_existing_post : given.five_posts_for_january_2011
- {
- static PostsByYear postsByYear;
- static Guid IdOfExistingPost;
-
- Because of = () =>
- {
- IdOfExistingPost = posts_entity_context.Entities.First().Id;
- post_statistics_service.AggregateForMonth(year, month, IdOfExistingPost);
- postsByYear = posts_by_year_entity_context.Entities.First();
- };
-
- It should_update_the_posts_in_january_2011_to_5 = () =>
- {
- posts_by_year_entity_context.Entities.Count().ShouldEqual(1);
- postsByYear.January.ShouldEqual(5);
- foreach (var post in postsByYear.Counts.Where(c => c.Key != Month.January))
- {
- post.Value.ShouldEqual(0);
- }
- };
- }
- }