Beispiel #1
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new IssuesClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((ApiOptions)null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((IssueRequest)null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent(null, new ApiOptions()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent(new IssueRequest(), null));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new IssuesClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((ApiOptions)null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((IssueRequest)null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent(null, new ApiOptions()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent(new IssueRequest(), null));
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.GetAllForCurrent();

                connection.Received().GetAll <Issue>(Arg.Is <Uri>(u => u.ToString() == "issues"),
                                                     Arg.Any <Dictionary <string, string> >());
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.GetAllForCurrent();

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

                await client.GetAllForCurrent();

                connection.Received().GetAll <Issue>(Arg.Is <Uri>(u => u.ToString() == "issues"),
                                                     Arg.Any <Dictionary <string, string> >(),
                                                     "application/vnd.github.squirrel-girl-preview+json",
                                                     Args.ApiOptions);
            }
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await client.GetAllForCurrent();

                connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "issues"),
                    Arg.Any<Dictionary<string, string>>(),
                    "application/vnd.github.squirrel-girl-preview",
                    Args.ApiOptions);
            }
            public void SendsAppropriateParameters()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.GetAllForCurrent(new IssueRequest { SortDirection = SortDirection.Ascending });

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

                client.GetAllForCurrent(new IssueRequest {
                    SortDirection = SortDirection.Ascending
                });

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

                await client.GetAllForCurrent(new IssueRequest { SortDirection = SortDirection.Ascending });

                connection.Received().GetAll <Issue>(Arg.Is <Uri>(u => u.ToString() == "issues"),
                                                     Arg.Is <Dictionary <string, string> >(d => d.Count == 4 &&
                                                                                           d["filter"] == "assigned" &&
                                                                                           d["sort"] == "created" &&
                                                                                           d["state"] == "open" &&
                                                                                           d["direction"] == "asc"),
                                                     "application/vnd.github.squirrel-girl-preview+json",
                                                     Args.ApiOptions);
            }
            public async Task SendsAppropriateParameters()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await client.GetAllForCurrent(new IssueRequest { SortDirection = SortDirection.Ascending });

                connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "issues"),
                    Arg.Is<Dictionary<string, string>>(d => d.Count == 4
                        && d["filter"] == "assigned"
                        && d["sort"] == "created"
                        && d["state"] == "open"
                        && d["direction"] == "asc"),
                    "application/vnd.github.squirrel-girl-preview",
                    Args.ApiOptions);
            }