Esempio n. 1
0
            public void RequestsCorrectUrlWithRepositoryId()
            {
                NewReaction newReaction = new NewReaction(ReactionType.Heart);

                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestReviewCommentReactionsClient(connection);

                client.Create(1, 1, newReaction);

                connection.Received().Post <Reaction>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/pulls/comments/1/reactions"), newReaction, "application/vnd.github.squirrel-girl-preview");
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                NewReaction newReaction = new NewReaction(ReactionType.Heart);

                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestReviewCommentReactionsClient(connection);

                client.Create(1, 1, newReaction);

                connection.Received().Post<Reaction>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/pulls/comments/1/reactions"), newReaction, "application/vnd.github.squirrel-girl-preview");
            }
Esempio n. 3
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestReviewCommentReactionsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null, "name", 1, new NewReaction(ReactionType.Heart)));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", null, 1, new NewReaction(ReactionType.Heart)));

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

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(1, 1, null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("", "name", 1, new NewReaction(ReactionType.Heart)));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", 1, new NewReaction(ReactionType.Heart)));
            }
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestReviewCommentReactionsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", 1, new NewReaction(ReactionType.Heart)));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, 1, new NewReaction(ReactionType.Heart)));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", 1, null));

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(1, 1, null));

                await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", 1, new NewReaction(ReactionType.Heart)));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", 1, new NewReaction(ReactionType.Heart)));
            }