public void Approve_EmployeeApprovesNullReview_Throws404() { Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake(); Mock<DbSet<GameReview>> gameReviewsDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<GameReview>().AsQueryable()); dbStub.Setup(db => db.GameReviews).Returns(gameReviewsDbSetStub.Object); ReviewsController controller = new ReviewsController(dbStub.Object, idGetter: null); Assert.That( async () => await controller.Approve(memberGuid, gameProductGuid), Throws.InstanceOf<HttpException>().And.Matches<HttpException>(e => e.GetHttpCode() == 404) ); }
public async void Approve_EmployeeApprovesReview_ReviewStatusSetApproved() { Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake(); Mock<DbSet<GameReview>> gameReviewsDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<GameReview> { pendinGameReview }.AsQueryable()); dbStub.Setup(db => db.GameReviews).Returns(gameReviewsDbSetStub.Object); gameReviewsDbSetStub.SetupForInclude(); ReviewsController controller = new ReviewsController(dbStub.Object, idGetter: null); await controller.Approve(memberGuid, gameProductGuid); Assert.That(pendinGameReview.ReviewStatus == ReviewStatus.Approved); }