public async Task EnsuresNotNullArgumentsWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(1, 1, null));
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(connection);

                await client.GetAll(1, 42);

                connection.Received().GetAll <Reaction>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/comments/42/reactions"), null, "application/vnd.github.squirrel-girl-preview", Args.ApiOptions);
            }
예제 #3
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(connection);

                await client.GetAll("fake", "repo", 42);

                connection.Received().GetAll <Reaction>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/comments/42/reactions"), "application/vnd.github.squirrel-girl-preview");
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new CommitCommentReactionsClient(connection);

                await client.GetAll(1, 42);

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

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

                client.Create(1, 1, newReaction);

                connection.Received().Post <Reaction>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/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 CommitCommentReactionsClient(connection);

                client.Create(1, 1, newReaction);

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

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

                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", 1));
            }
예제 #8
0
            public async Task EnsuresNotNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(connection);

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

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("", "name", 1));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("owner", "", 1));
            }
            public async Task RequestsCorrectUrlApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(connection);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    StartPage = 1,
                    PageSize  = 1
                };

                await client.GetAll("fake", "repo", 42, options);

                connection.Received().GetAll <Reaction>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/comments/42/reactions"), null, "application/vnd.github.squirrel-girl-preview", options);
            }
            public async Task EnsuresNotNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitCommentReactionsClient(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 EnsuresNotNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new CommitCommentReactionsClient(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)));
            }