public async Task EnsuresArgumentsNotNull()
            {
                var releasesClient = new ReleasesClient(Substitute.For<IApiConnection>());
                var data = new NewRelease("fake-tag");

                Assert.Throws<ArgumentNullException>(() => new NewRelease(null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Create(null, "name", data));
                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Create("owner", null, data));
                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Create("owner", "name", null));
            }
Exemple #2
0
            public async Task EnsuresArgumentsNotNull()
            {
                var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>());
                var data           = new NewRelease("fake-tag");

                Assert.Throws <ArgumentNullException>(() => new NewRelease(null));
                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Create(null, "name", data));

                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Create("owner", null, data));

                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Create("owner", "name", null));
            }
Exemple #3
0
            public async Task RequestsCorrectUrl()
            {
                var client         = Substitute.For <IApiConnection>();
                var releasesClient = new ReleasesClient(client);
                var data           = new NewRelease("fake-tag");

                await releasesClient.Create("fake", "repo", data);

                client.Received().Post <Release>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/releases"),
                                                 data,
                                                 "application/vnd.github.v3");
            }
            public void RequestsCorrectUrl()
            {
                var client = Substitute.For<IApiConnection>();
                var releasesClient = new ReleasesClient(client);
                var data = new NewRelease("fake-tag");

                releasesClient.Create("fake", "repo", data);

                client.Received().Post<Release>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/releases"),
                    data,
                    "application/vnd.github.v3");
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var client = Substitute.For<IApiConnection>();
                var releasesClient = new ReleasesClient(client);
                var data = new NewRelease("fake-tag");

                await releasesClient.Create(1, data);

                client.Received().Post<Release>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/releases"),
                    data,
                    "application/vnd.github.v3");
            }