Skip to content

Commit

Permalink
Fix testing sample links (#3747)
Browse files Browse the repository at this point in the history
Fixes #3746
  • Loading branch information
roji authored Mar 1, 2022
1 parent bf45e21 commit f6a5163
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion entity-framework/core/testing/testing-with-the-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The above example showed a read-only test, which is the easy case from a test is

Here's a controller method which adds a Blog to our database:

[!code-csharp[Main](../../../samples/core/Testing/BloggingWebApi/Controllers/BloggingController.cs?name=PostBlog)]
[!code-csharp[Main](../../../samples/core/Testing/BloggingWebApi/Controllers/BloggingController.cs?name=AddBlog)]

We can test this method with the following:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public ActionResult<Blog> GetBlog(string name)
public ActionResult<Blog[]> GetAllBlogs()
=> _context.Blogs.OrderBy(b => b.Name).ToArray();

#region AddBlog
[HttpPost]
public ActionResult AddBlog(string name, string url)
{
Expand All @@ -36,7 +37,9 @@ public ActionResult AddBlog(string name, string url)

return Ok();
}
#endregion

#region UpdateBlogUrl
[HttpPost]
public ActionResult UpdateBlogUrl(string name, string url)
{
Expand All @@ -55,5 +58,6 @@ public ActionResult UpdateBlogUrl(string name, string url)
transaction.Commit();
return Ok();
}
#endregion
}
}

0 comments on commit f6a5163

Please sign in to comment.