public void EnsureNonWhitespaceArguments(string whitespace) { var client = new DeploymentStatusClient(Substitute.For<IApiConnection>()); Assert.Throws<ArgumentException>(() => client.GetAll(whitespace, "name", 1)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", whitespace, 1)); }
public async Task EnsuresNonNullArguments() { var client = new DeploymentStatusClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, "name", 1)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", null, 1)); }
public void EnsuresNonEmptyArguments() { var client = new DeploymentStatusClient(Substitute.For<IApiConnection>()); Assert.Throws<ArgumentException>(() => client.GetAll("", "name", 1)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", 1)); }
public async Task EnsureNonWhitespaceArguments(string whitespace) { var client = new DeploymentStatusClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll(whitespace, "name", 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", whitespace, 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll(whitespace, "name", 1, ApiOptions.None)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", whitespace, 1, ApiOptions.None)); }
public async Task EnsuresNonEmptyArguments() { var client = new DeploymentStatusClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", 1, ApiOptions.None)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", 1, ApiOptions.None)); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); var expectedUrl = "repos/owner/name/deployments/1/statuses"; client.GetAll("owner", "name", 1); connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl)); }
public void UsesPreviewAcceptHeader() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); client.GetAll("owner", "name", 1); connection.Received().GetAll<DeploymentStatus>(Arg.Any<Uri>(), Arg.Any<IDictionary<string, string>>(), expectedAcceptsHeader); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); var expectedUrl = "repositories/1/deployments/1/statuses"; await client.GetAll(1, 1); connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl), Args.ApiOptions); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); var expectedUrl = "repos/owner/name/deployments/1/statuses"; await client.GetAll("owner", "name", 1); connection.Received().GetAll< DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl), null, "application/vnd.github.ant-man-preview+json", Args.ApiOptions); }
public void RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); var expectedUrl = "repos/owner/name/deployments/1/statuses"; var options =new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAll("owner", "name", 1, options); connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl), options); }
public void RequestsCorrectUrlWithPreviewAcceptHeaders() { var connection = Substitute.For<IApiConnection>(); var client = new DeploymentStatusClient(connection); var expectedUrl = "repos/owner/name/deployments/1/statuses"; client.GetAll("owner", "name", 1); connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl), Arg.Any<IDictionary<string, string>>(), Arg.Is<string>(a => a == AcceptHeaders.DeploymentApiPreview), Args.ApiOptions); }