public async Task EnsureNonNullArguments() { var client = new StatisticsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetParticipation(null, "name")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetParticipation("owner", null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetParticipation("", "name")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetParticipation("owner", "")); }
public void RequestsCorrectUrl() { var expectedEndPoint = new Uri("/repos/username/repositoryName/stats/participation", UriKind.Relative); var client = Substitute.For <IApiConnection>(); var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation("username", "repositoryName"); client.Received().GetQueuedOperation <Participation>(expectedEndPoint, Args.CancellationToken); }
public void RequestsCorrectUrlWithRepositoryIdWithCancellationToken() { var expectedEndPoint = new Uri("repositories/1/stats/participation", UriKind.Relative); var cancellationToken = new CancellationToken(); var client = Substitute.For <IApiConnection>(); var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation(1, cancellationToken); client.Received().GetQueuedOperation <Participation>(expectedEndPoint, cancellationToken); }
public async Task ThrowsIfGivenNullRepositoryName() { var statisticsClient = new StatisticsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null)); }
public async Task EnsureNonNullArguments() { var client = new StatisticsClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetParticipation(null, "name")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetParticipation("owner", null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetParticipation("", "name")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetParticipation("owner", "")); }
public void RequestsCorrectUrlWithRepositoryIdWithCancellationToken() { var expectedEndPoint = new Uri("repositories/1/stats/participation", UriKind.Relative); var cancellationToken = new CancellationToken(); var client = Substitute.For<IApiConnection>(); var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation(1, cancellationToken); client.Received().GetQueuedOperation<Participation>(expectedEndPoint, cancellationToken); }
public void RequestsCorrectUrl() { var expectedEndPoint = new Uri("repos/owner/name/stats/participation", UriKind.Relative); var client = Substitute.For<IApiConnection>(); var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation("owner", "name"); client.Received().GetQueuedOperation<Participation>(expectedEndPoint, Args.CancellationToken); }
public async Task ThrowsIfGivenNullRepositoryName() { var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null)); }
public async Task ThrowsIfGivenNullOwner() { var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName")); }
public async Task ThrowsIfGivenNullOwner() { var statisticsClient = new StatisticsClient(Substitute.For <IApiConnection>()); await AssertEx.Throws <ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName")); }