예제 #1
0
        public async Task EnsuresArgumentsNotNullOrEmpty()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new IssueCommentsClient(connection);

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

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

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

            await AssertEx.Throws <ArgumentException>(async() => await client.Delete("owner", "", 42));
        }
예제 #2
0
        public void DeletesCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new IssueCommentsClient(connection);

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

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

                client.Delete(1, 42);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/comments/42"));
            }
            public async Task EnsuresArgumentsNotNullOrEmpty()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete(null, "name", 42));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete("owner", null, 42));

                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("", "name", 42));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("owner", "", 42));
            }
            public void DeletesCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                client.Delete(1, 42);

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/comments/42"));
            }
            public void DeletesCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

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

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"));
            }