public async Task GetByArticleIdAsync() { var apiConnection = Substitute.For <IApiConnection>(); var client = new CommentClient(apiConnection); await client.GetByArticleIdAsync(1); await apiConnection.Received().ExecuteGetCollectionAsync <Comment>("comments?a_id=1"); }
public async Task GetByArticleIdAsync_ArticleIdZero_Throw() { var apiConnection = Substitute.For <IApiConnection>(); var client = new CommentClient(apiConnection); await Assert.ThrowsExceptionAsync <ArgumentOutOfRangeException>(async() => await client.GetByArticleIdAsync(0)); await apiConnection.DidNotReceive().ExecuteGetCollectionAsync <Comment>(Arg.Any <string>()); }