Exemplo n.º 1
0
            public void EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => releasesClient.EditRelease(null, "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentException>(() => releasesClient.EditRelease("", "name", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentNullException>(() => releasesClient.EditRelease("owner", null, 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentException>(() => releasesClient.EditRelease("owner", "", 1, new ReleaseUpdate("tag")));
                Assert.Throws <ArgumentNullException>(() => releasesClient.EditRelease("owner", "name", 1, null));
            }
Exemplo n.º 2
0
            public void RequestsTheCorrectUrl()
            {
                var connection     = Substitute.For <IApiConnection>();
                var releasesClient = new ReleasesClient(connection);
                var data           = new ReleaseUpdate("fake-tag");

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

                connection.Received().Patch <Release>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/releases/1"), data);
            }
Exemplo n.º 3
0
            public async Task EnsuresNonNullArguments()
            {
                var releasesClient = new ReleasesClient(Substitute.For<IApiConnection>());

                AssertEx.Throws<ArgumentNullException>(async () => await releasesClient.EditRelease(null, "name", new ReleaseUpdate("tag")));
                AssertEx.Throws<ArgumentException>(async () => await releasesClient.EditRelease("", "name", new ReleaseUpdate("tag")));
                AssertEx.Throws<ArgumentNullException>(async () => await releasesClient.EditRelease("owner", null, new ReleaseUpdate("tag")));
                AssertEx.Throws<ArgumentException>(async () => await releasesClient.EditRelease("owner", "", new ReleaseUpdate("tag")));
                AssertEx.Throws<ArgumentNullException>(async () => await releasesClient.EditRelease("owner", "name", null));
            }
Exemplo n.º 4
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var releasesClient = new ReleasesClient(connection);
                var data = new ReleaseUpdate("fake-tag");

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

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

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