Ejemplo n.º 1
0
        public async Task GetByIdAsync()
        {
            var apiClient = Substitute.For <IApiConnection>();
            var client    = new ArticleClient(apiClient);

            await client.GetByIdAsync(1);

            await apiClient.Received().ExecuteGetAsync <Article>("articles/1");
        }
Ejemplo n.º 2
0
        public async Task GetByIdAsync_ArticleIdZero_Throw()
        {
            var apiClient = Substitute.For <IApiConnection>();
            var client    = new ArticleClient(apiClient);

            await Assert.ThrowsExceptionAsync <ArgumentOutOfRangeException>(async() => await client.GetByIdAsync(0));

            await apiClient.DidNotReceive().ExecuteGetAsync <Article>(Arg.Any <string>());
        }