public async Task EnsuresNonNullArguments()
            {
                var client = new IssueCommentsClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Get("", "name", 1));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null, 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "", 1));
            }
예제 #2
0
        public async Task EnsuresNonNullArguments()
        {
            var client = new IssueCommentsClient(Substitute.For <IApiConnection>());

            await AssertEx.Throws <ArgumentNullException>(async() => await client.Get(null, "name", 1));

            await AssertEx.Throws <ArgumentException>(async() => await client.Get("", "name", 1));

            await AssertEx.Throws <ArgumentNullException>(async() => await client.Get("owner", null, 1));

            await AssertEx.Throws <ArgumentException>(async() => await client.Get("owner", "", 1));
        }
        public void RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new IssueCommentsClient(connection);

            client.Get("fake", "repo", 42);

            connection.Received().Get <IssueComment>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"));
        }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                await client.Get(1, 42);

                connection.Received().Get<IssueComment>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/comments/42"),
                    Arg.Any<Dictionary<string, string>>(),
                    "application/vnd.github.squirrel-girl-preview");
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssueCommentsClient(connection);

                await client.Get(1, 42);

                connection.Received().Get <IssueComment>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/comments/42"),
                                                         Arg.Any <Dictionary <string, string> >(),
                                                         "application/vnd.github.squirrel-girl-preview+json");
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssueCommentsClient(connection);

                client.Get("fake", "repo", 42);

                connection.Received().Get <IssueComment>(
                    Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"),
                    Arg.Any <Dictionary <string, string> >(),
                    Arg.Is <string>(s => s == "application/vnd.github.squirrel-girl-preview"));
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                client.Get("fake", "repo", 42);

                connection.Received().Get<IssueComment>(
                    Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"), 
                    Arg.Any<Dictionary<string, string>>(), 
                    Arg.Is<string>(s => s == "application/vnd.github.squirrel-girl-preview"));
            }