private BookClubService CreateBookClubService() { var userId = Guid.Parse(User.Identity.GetUserId()); var bookClubService = new BookClubService(userId); return(bookClubService); }
public IHttpActionResult Get(int id) { BookClubService bookClubService = CreateBookClubService(); var book = bookClubService.GetBookClubById(id); return(Ok(book)); }
public IHttpActionResult Get(string name) { BookClubService bookClubService = CreateBookClubService(); var bookClubName = bookClubService.GetBookClubByName(name); return(Ok(bookClubName)); }
public IHttpActionResult Get() { BookClubService bookClubService = CreateBookClubService(); var books = bookClubService.GetBookClubs(); return(Ok(books)); }
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(); }