public void AddWishListItem(UserId id, WishListItemId wishlistItemId, RestaurantId restoId, string someNotes)
        {
            if (_disabled)
            {
                throw new AggregateException("Can not add a to the wish list of a disabled user.");
            }

            if (MyWishListIsEmpty() || ThatResturantIsNotInMyWishList(restoId))
            {
                ApplyChange(UserEvents.WishListItemAdded(id, wishlistItemId, restoId, someNotes));
            }
        }
Example #2
0
 protected void When(UserEvents.UserHasNewWishListItem newWishListItem)
 {
     Id      = new WishListItemId(newWishListItem.WishListItemId);
     RestoId = new RestaurantId(newWishListItem.RestaurantId);
 }
 private bool ThatResturantIsNotInMyWishList(RestaurantId restoId)
 {
     return(!_wishList.Any(w => w.RestoId.Equals(restoId)));
 }