コード例 #1
0
        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);
        }
コード例 #2
0
 private void GivenThatModelReturns(DoFavoriteResult mockResult)
 {
     Models.Setup(m => m.Favorite.DoFavorite(UserId, StoryId)).Returns(mockResult);
 }