Example #1
0
        public async Task GetByIdAsync()
        {
            var apiConnection = Substitute.For <IApiConnection>();
            var client        = new CommentClient(apiConnection);

            await client.GetByIdAsync("123");

            await apiConnection.Received().ExecuteGetAsync <Comment>("comments/123");
        }
Example #2
0
        public async Task GetByIdAsync_CommentIdEmpty_Throw()
        {
            var apiConnection = Substitute.For <IApiConnection>();
            var client        = new CommentClient(apiConnection);

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await client.GetByIdAsync(string.Empty));

            await apiConnection.DidNotReceive().ExecuteGetAsync <Comment>(Arg.Any <string>());
        }