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

            await client.GetByPathAsync("test", "test");

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

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await client.GetByPathAsync(string.Empty, "test"));

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