File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
BlogWebApp/Tests/Blog.ServicesTests/EntityServices Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1477,6 +1477,23 @@ public async Task UpdateAsync_WhenCommentExists_ShouldReturnTag(string newTagTit
14771477 Assert . Equal ( newTagTitle , tag . Title ) ;
14781478 }
14791479
1480+ /// <summary>
1481+ /// Async Update tag.
1482+ /// Should throw exception when repository throws exception.
1483+ /// </summary>
1484+ [ Fact ]
1485+ public async Task UpdateAsync_WhenRepositoryThrowsException_ShouldThrowException ( )
1486+ {
1487+ //Arrange
1488+ var tag = SetupTagFixture ( ) . Create ( ) ;
1489+
1490+ _tagsRepositoryMock . Setup ( x => x . UpdateAsync ( It . IsAny < Tag > ( ) ) )
1491+ . ThrowsAsync ( new Exception ( "Test exception" ) ) ;
1492+
1493+ //Assert
1494+ await Assert . ThrowsAsync < Exception > ( ( ) => _tagsService . UpdateAsync ( tag ) ) ;
1495+ }
1496+
14801497 #endregion
14811498
14821499 #region Upadate Async Enumerable function
You can’t perform that action at this time.
0 commit comments