public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new CommitStatusClient(connection);

                client.GetCombined("fake", "repo", "sha");

                connection.Received()
                    .Get<CombinedCommitStatus>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/status"), null);
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitStatusClient(connection);

                client.GetCombined("fake", "repo", "sha");

                connection.Received()
                .Get <CombinedCommitStatus>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/status"), null);
            }
Example #3
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CommitStatusClient(connection);

                await client.GetCombined(1, "sha");

                connection.Received()
                .Get <CombinedCommitStatus>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/commits/sha/status"));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new CommitStatusClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentException>(() =>
                    client.GetCombined("", "name", "sha"));
                await Assert.ThrowsAsync<ArgumentException>(() =>
                    client.GetCombined("owner", "", "sha"));
                await Assert.ThrowsAsync<ArgumentException>(() =>
                    client.GetCombined("owner", "name", ""));
                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.GetCombined(null, "name", "sha"));
                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.GetCombined("owner", null, "sha"));
                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.GetCombined("owner", "name", null));
            }
Example #5
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new CommitStatusClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetCombined(null, "name", "sha"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetCombined("owner", null, "sha"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetCombined("owner", "name", null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetCombined(1, null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetCombined("", "name", "sha"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetCombined("owner", "", "sha"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetCombined("owner", "name", ""));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetCombined(1, ""));
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new CommitStatusClient(connection);

                await client.GetCombined(1, "sha");

                connection.Received()
                    .Get<CombinedCommitStatus>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/commits/sha/status"));
            }