コード例 #1
0
            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", ""));
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
 public async Task ThrowsIfGivenNullRepositoryName()
 {
     var statisticsClient = new StatisticsClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null));
 }
コード例 #5
0
            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", ""));
            }
コード例 #6
0
            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);
            }
コード例 #7
0
            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);
            }
コード例 #8
0
 public async Task ThrowsIfGivenNullRepositoryName()
 {
     var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
     await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null));
 }
コード例 #9
0
 public async Task ThrowsIfGivenNullOwner()
 {
     var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName"));
 }
コード例 #10
0
 public async Task ThrowsIfGivenNullOwner()
 {
     var statisticsClient = new StatisticsClient(Substitute.For <IApiConnection>());
     await AssertEx.Throws <ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName"));
 }