Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testing sample links #3747

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}