コード例 #1
0
            public void EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => releasesClient.Edit(null, "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentException>(() => releasesClient.Edit("", "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentNullException>(() => releasesClient.Edit("owner", null, 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentException>(() => releasesClient.Edit("owner", "", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentNullException>(() => releasesClient.Edit("owner", "name", 1, null));
            }
コード例 #2
0
            public async Task EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>());
                var releaseUpdate  = new ReleaseUpdate {
                    TagName = "tag"
                };

                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Edit(null, "name", 1, releaseUpdate));

                await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Edit("", "name", 1, releaseUpdate));

                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Edit("owner", null, 1, releaseUpdate));

                await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Edit("owner", "", 1, releaseUpdate));

                await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Edit("owner", "name", 1, null));
            }
コード例 #3
0
            public void RequestsTheCorrectUrl()
            {
                var connection     = Substitute.For <IApiConnection>();
                var releasesClient = new ReleasesClient(connection);
                var data           = new ReleaseUpdate("fake-tag");

                releasesClient.Edit("fake", "repo", 1, data);

                connection.Received().Patch <Release>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/releases/1"), data);
            }
コード例 #4
0
            public async Task RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection     = Substitute.For <IApiConnection>();
                var releasesClient = new ReleasesClient(connection);

                var data = new ReleaseUpdate {
                    TagName = "fake-tag"
                };

                await releasesClient.Edit(1, 1, data);

                connection.Received().Patch <Release>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/releases/1"), data);
            }
コード例 #5
0
            public async Task EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For<IApiConnection>());
                var releaseUpdate = new ReleaseUpdate { TagName = "tag" };

                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Edit(null, "name", 1, releaseUpdate));
                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Edit("owner", null, 1, releaseUpdate));
                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Edit("owner", "name", 1, null));

                await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Edit(1, 1, null));

                await Assert.ThrowsAsync<ArgumentException>(() => releasesClient.Edit("", "name", 1, releaseUpdate));
                await Assert.ThrowsAsync<ArgumentException>(() => releasesClient.Edit("owner", "", 1, releaseUpdate));
                
            }
コード例 #6
0
            public async Task RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var releasesClient = new ReleasesClient(connection);

                var data = new ReleaseUpdate { TagName = "fake-tag" };

                await releasesClient.Edit(1, 1, data);

                connection.Received().Patch<Release>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/releases/1"), data);
            }
コード例 #7
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var releasesClient = new ReleasesClient(connection);
                var data = new ReleaseUpdate { TagName = "fake-tag" };

                releasesClient.Edit("fake", "repo", 1, data);

                connection.Received().Patch<Release>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/releases/1"), data);
            }
コード例 #8
0
            public void EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For<IApiConnection>());

                Assert.Throws<ArgumentNullException>(() => releasesClient.Edit(null, "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws<ArgumentException>(() => releasesClient.Edit("", "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws<ArgumentNullException>(() => releasesClient.Edit("owner", null, 1, new ReleaseUpdate("tag")));
                Assert.Throws<ArgumentException>(() => releasesClient.Edit("owner", "", 1, new ReleaseUpdate("tag")));
                Assert.Throws<ArgumentNullException>(() => releasesClient.Edit("owner", "name", 1, null));
            }