File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
BlogWebApp/Tests/Blog.ServicesTests/EntityServices Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1582,6 +1582,27 @@ public async Task UpdateAsyncEnumerable_WhenCommentExists_ShouldReturnComment(st
15821582 }
15831583 }
15841584
1585+ /// <summary>
1586+ /// Update Async Enumerable tags.
1587+ /// Should throw exception when repository throws exception.
1588+ /// </summary>
1589+ [ Fact ]
1590+ public async Task UpdateAsyncEnumerable_WhenRepositoryThrowsException_ShouldThrowException ( )
1591+ {
1592+ //Arrange
1593+ var random = new Random ( ) ;
1594+ var itemsCount = random . Next ( 100 ) ;
1595+ var tags = SetupTagFixture ( )
1596+ . CreateMany ( itemsCount )
1597+ . ToList ( ) ;
1598+
1599+ _tagsRepositoryMock . Setup ( x => x . UpdateAsync ( It . IsAny < IEnumerable < Tag > > ( ) ) )
1600+ . Throws ( new Exception ( "Test exception" ) ) ;
1601+
1602+ //Assert
1603+ await Assert . ThrowsAsync < Exception > ( ( ) => _tagsService . UpdateAsync ( tags ) ) ;
1604+ }
1605+
15851606 #endregion
15861607
15871608 #endregion
You can’t perform that action at this time.
0 commit comments