Example #1
0
        public void WhenGetSubscriptionsOfUserThenReturnAllSubscriptionAggregatesOfUser()
        {
            var followee  = new UserId("*****@*****.**");
            var follower1 = new UserId("*****@*****.**");
            var follower2 = new UserId("*****@*****.**");

            _followersRepository.Save(new FollowerProjection(followee, follower1));
            _followersRepository.Save(new FollowerProjection(followee, follower2));
            _eventsStore.Store(new UserFollowed(new SubscriptionId(follower1, followee)));
            _eventsStore.Store(new UserFollowed(new SubscriptionId(follower2, followee)));

            var subscriptions = _subscriptionsRepository.GetSubscriptionsOfUser(followee);

            Check.That(subscriptions).HasSize(2);
        }
        public void WhenSaveThenGetFollowersReturnFollowerId()
        {
            var followee = new UserId("*****@*****.**");
            var follower = new UserId("*****@*****.**");

            _repository.Save(new FollowerProjection(followee, follower));

            var followers = _repository.GetFollowers(followee);

            Check.That(followers).ContainsExactly(follower);
        }
 private void AddFollower(SubscriptionId subscriptionId)
 {
     _followersRepository.Save(new FollowerProjection(SubscriptionId.Followee, subscriptionId.Follower));
     _eventsStore.Store(new UserFollowed(subscriptionId));
 }