public HttpResponseMessage Get() { // TODO: we should probably try and filter at the query var reviews = _reviewTable.GetReviews().Where(o => o.Category.IsSpecified()); return(Request.CreateResponse(HttpStatusCode.OK, reviews)); }
public void TestLikeItem() { var context = new Mock <IContext>(); context.Setup(c => c.Environment).Returns("LOCAL"); var db = new ReviewTable(_dbClient, context.Object); var result = db.GetReviews().ToList(); result.Should().NotBeEmpty(); var itemToFetch = result.First(); var theFetchedItem = db.GetReview(itemToFetch.Category, itemToFetch.Id); theFetchedItem.Should().NotBeNull(); var likes = theFetchedItem.Likes; db.LikeReview(theFetchedItem.Category, theFetchedItem.Id); // TODO: return the new number of likes? // may not be updated immediatley of course, but let's see... var theLikedItem = db.GetReview(itemToFetch.Category, itemToFetch.Id); theLikedItem.Should().NotBeNull(); theLikedItem.Likes.Should().BeGreaterThan(likes); }
public void TestGetItems() { var context = new Mock <IContext>(); context.Setup(c => c.Environment).Returns("LOCAL"); var db = new ReviewTable(_dbClient, context.Object); var result = db.GetReviews().ToList(); result.Should().NotBeEmpty(); var itemToFetch = result.First(); var theFetchedItem = db.GetReview(itemToFetch.Category, itemToFetch.Id); theFetchedItem.Should().NotBeNull(); var anotherItemToFecth = db.GetReview(Category.Apps, Guid.NewGuid()); anotherItemToFecth.Should().BeNull(); }