Skip to content

Commit 59683bb

Browse files
committed
Add excepion test case for GetAll in tags service tests
1 parent e9f51d3 commit 59683bb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

BlogWebApp/Tests/Blog.ServicesTests/EntityServices/TagsServiceTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ public void GetAll_WhenTagsDoesNotExists_ShouldReturnNothing()
147147
}
148148

149149
/// <summary>
150+
/// Get all tags.
151+
/// Should throw exception when repository throws exception.
152+
/// </summary>
153+
[Fact]
154+
public void GetAll_WhenRepositoryThrowsException_ShouldThrowException()
155+
{
156+
//Arrange
157+
_tagsRepositoryMock.Setup(x => x.GetAll())
158+
.Throws(() => new Exception("Test exception"));
159+
160+
//Assert
161+
Assert.Throws<Exception>(() => _tagsService.GetAll());
162+
}
163+
150164
#endregion
151165

152166
#region Get All Async function

0 commit comments

Comments
 (0)