Пример #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);
            }
            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));
            }