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)); }
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)); }
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); }
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 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)); }
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); }
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)); }