コード例 #1
0
        private BookClubService CreateBookClubService()
        {
            var userId          = Guid.Parse(User.Identity.GetUserId());
            var bookClubService = new BookClubService(userId);

            return(bookClubService);
        }
コード例 #2
0
        public IHttpActionResult Get(int id)
        {
            BookClubService bookClubService = CreateBookClubService();
            var             book            = bookClubService.GetBookClubById(id);

            return(Ok(book));
        }
コード例 #3
0
        public IHttpActionResult Get(string name)
        {
            BookClubService bookClubService = CreateBookClubService();
            var             bookClubName    = bookClubService.GetBookClubByName(name);

            return(Ok(bookClubName));
        }
コード例 #4
0
        public IHttpActionResult Get()
        {
            BookClubService bookClubService = CreateBookClubService();
            var             books           = bookClubService.GetBookClubs();

            return(Ok(books));
        }
コード例 #5
0
        public void BookClubServiceActivateMembership()
        {
            AcceptingPurchaseOrderItemLine acceptingPurchaseOrderItemLine = new AcceptingPurchaseOrderItemLine
            {
                CustomerId = 3344656,
                Item       = new ItemLineRequest {
                    Description = "Book Club Membership", Type = ItemLineType.Membership, Category = ItemLineCategory.Book
                }
            };
            ActivatedMembership activatedMembership = new ActivatedMembership
            {
                Activated = true
            };

            var mockMediator = new Mock <IMediator>();
            IBookClubMembershipRepository bookClubMembershipRepository = GetFakeBookClubMembershipRepository();

            var sut = new BookClubService(mockMediator.Object, bookClubMembershipRepository);

            sut.Handle(acceptingPurchaseOrderItemLine);

            bookClubMembershipRepository.Get(acceptingPurchaseOrderItemLine.CustomerId).ShouldNotBeNull();
        }