示例#1
0
            public void EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                Assert.Throws <ArgumentNullException>(() => client.GetForRepository(null, "name", new RepositoryIssueRequest()));
                Assert.Throws <ArgumentException>(() => client.GetForRepository("", "name", new RepositoryIssueRequest()));
                Assert.Throws <ArgumentNullException>(() => client.GetForRepository("owner", null, new RepositoryIssueRequest()));
                Assert.Throws <ArgumentException>(() => client.GetForRepository("owner", "", new RepositoryIssueRequest()));
                Assert.Throws <ArgumentNullException>(() => client.GetForRepository("owner", "name", null));
            }
示例#2
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.GetForRepository("fake", "repo");

                connection.Received().GetAll <Issue>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues"),
                                                     Arg.Any <Dictionary <string, string> >());
            }
示例#3
0
            public void SendsAppropriateParameters()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.GetForRepository("fake", "repo", new RepositoryIssueRequest
                {
                    SortDirection = SortDirection.Ascending
                });

                connection.Received().GetAll <Issue>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues"),
                                                     Arg.Is <Dictionary <string, string> >(d => d.Count == 4 &&
                                                                                           d["state"] == "open" &&
                                                                                           d["direction"] == "asc" &&
                                                                                           d["sort"] == "created" &&
                                                                                           d["filter"] == "assigned"));
            }
            public void SendsAppropriateParameters()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.GetForRepository("fake", "repo", new RepositoryIssueRequest
                {
                    SortDirection = SortDirection.Ascending
                });

                connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues"),
                    Arg.Is<Dictionary<string, string>>(d => d.Count == 4
                        && d["state"] == "open"
                        && d["direction"] == "asc"
                        && d["sort"] == "created"
                        && d["filter"] == "assigned"));
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.GetForRepository("fake", "repo");

                connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues"),
                    Arg.Any<Dictionary<string, string>>());
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetForRepository(null, "name", new RepositoryIssueRequest()));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetForRepository("", "name", new RepositoryIssueRequest()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetForRepository("owner", null, new RepositoryIssueRequest()));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetForRepository("owner", "", new RepositoryIssueRequest()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetForRepository("owner", "name", null));
            }