public void EnsuresNonNullArguments() { var client = new RepositoriesClient(Substitute.For <IApiConnection>()); Assert.Throws <ArgumentNullException>(() => client.GetAllTeams(null, "repo")); Assert.Throws <ArgumentNullException>(() => client.GetAllTeams("owner", null)); Assert.Throws <ArgumentException>(() => client.GetAllTeams("", "repo")); Assert.Throws <ArgumentException>(() => client.GetAllTeams("owner", "")); }
public void GetsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); client.GetAllTeams("owner", "name"); connection.Received() .GetAll <Team>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/name/teams")); }
public async Task RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); await client.GetAllTeams(1); connection.Received() .GetAll <Team>( Arg.Is <Uri>(u => u.ToString() == "repositories/1/teams"), Args.ApiOptions); }
public async Task RequestsTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); await client.GetAllTeams("owner", "name"); connection.Received() .GetAll <Team>( Arg.Is <Uri>(u => u.ToString() == "repos/owner/name/teams"), null, "application/vnd.github.hellcat-preview+json", Args.ApiOptions); }
public async Task EnsuresNonNullArguments() { var client = new RepositoriesClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams(null, "repo")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams("owner", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams(null, "repo", ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams("owner", null, ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams("owner", "repo", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTeams(1, null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllTeams("", "repo")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllTeams("owner", "")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllTeams("", "repo", ApiOptions.None)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllTeams("owner", "", ApiOptions.None)); }
public async Task RequestsTheCorrectUrlWithRepositoryIdWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; await client.GetAllTeams(1, options); connection.Received() .GetAll <Team>( Arg.Is <Uri>(u => u.ToString() == "repositories/1/teams"), options); }
public async Task EnsuresNonNullArguments() { var client = new RepositoriesClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams(null, "repo")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams("owner", null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams(null, "repo", ApiOptions.None)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams("owner", null, ApiOptions.None)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams("owner", "repo", null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllTeams(1, null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTeams("", "repo")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTeams("owner", "")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTeams("", "repo", ApiOptions.None)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTeams("owner", "", ApiOptions.None)); }
public async Task RequestsTheCorrectUrlWithRepositoryIdWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; await client.GetAllTeams(1, options); connection.Received() .GetAll<Team>( Arg.Is<Uri>(u => u.ToString() == "repositories/1/teams"), options); }
public async Task RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); await client.GetAllTeams(1); connection.Received() .GetAll<Team>( Arg.Is<Uri>(u => u.ToString() == "repositories/1/teams"), Args.ApiOptions); }
public void GetsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); client.GetAllTeams("owner", "name"); connection.Received() .GetAll<Team>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/teams")); }