public async Task EnsuresNonNullArguments() { var client = new RepositoriesClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name")); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null)); }
public void RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); client.Get("fake", "repo"); connection.Received().Get <Repository>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoriesClient(connection); await client.Get(1); connection.Received().Get <Repository>( Arg.Is <Uri>(u => u.ToString() == "repositories/1"), null, "application/vnd.github.polaris-preview+json,application/vnd.github.drax-preview+json"); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); client.Get("fake", "repo"); connection.Received().Get<Repository>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo"), null); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); await client.Get(1); connection.Received().Get<Repository>(Arg.Is<Uri>(u => u.ToString() == "repositories/1")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoriesClient(connection); await client.Get(1); connection.Received().Get<Repository>( Arg.Is<Uri>(u => u.ToString() == "repositories/1"), null, "application/vnd.github.polaris-preview+json"); }