public void IfModelDoesNotSucceedResultIsJsonFailure(DoFavoriteResult doFavoriteResult, [NotNull] string expectedTextInMessage) { GivenThatModelReturns(doFavoriteResult); var response = Browser.Post("/api/story/favorite", with => { with.CookieLoggedInUser(UserId); with.FormValue("storyId", StoryId.ToString()); }); ThenModelIsCalledWithCorrectParameters(); ThenJsonResponse(response) .IsFailure() .HasMessageContaining(expectedTextInMessage); }
private void GivenThatModelReturns(DoFavoriteResult mockResult) { Models.Setup(m => m.Favorite.DoFavorite(UserId, StoryId)).Returns(mockResult); }