Test for invalid id
This commit is contained in:
parent
7e79bbee3e
commit
1837f126a3
2 changed files with 10 additions and 6 deletions
|
@ -46,7 +46,17 @@ namespace Robware.Api.Blog.Tests {
|
|||
|
||||
var controller = new BlogController(logger, repo);
|
||||
(await controller.Get("url")).Result.Should().BeOfType<NotFoundObjectResult>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_WithInvalidId_Returns404() {
|
||||
var logger = Substitute.For<ILogger<BlogController>>();
|
||||
var repo = Substitute.For<IBlogRepository>();
|
||||
|
||||
repo.GetPostByIdAsync(1).Throws(new ItemNotFoundException("", null));
|
||||
|
||||
var controller = new BlogController(logger, repo);
|
||||
(await controller.Get("1")).Result.Should().BeOfType<NotFoundObjectResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue