public void EnsuresArgumentsNotNull()
        {
            var gitHubClient = Substitute.For <IGitHubClient>();
            var client       = new ObservableIssuesClient(gitHubClient);

            Assert.Throws <ArgumentNullException>(() => client.Lock(null, "name", 42));
            Assert.Throws <ArgumentException>(() => client.Lock("", "name", 42));
            Assert.Throws <ArgumentNullException>(() => client.Lock("owner", null, 42));
            Assert.Throws <ArgumentException>(() => client.Lock("owner", "", 42));
        }
        public void LocksIssue()
        {
            var gitHubClient = Substitute.For <IGitHubClient>();
            var client       = new ObservableIssuesClient(gitHubClient);

            client.Lock("fake", "repo", 42);
            gitHubClient.Issue.Received().Lock("fake", "repo", 42);
        }
        public void LocksIssueWithRepositoryId()
        {
            var gitHubClient = Substitute.For <IGitHubClient>();
            var client       = new ObservableIssuesClient(gitHubClient);

            client.Lock(1, 42);

            gitHubClient.Issue.Received().Lock(1, 42);
        }
Ejemplo n.º 4
0
    public async Task CanLockAndUnlockIssues()
    {
        var newIssue = new NewIssue("Integration Test Issue");

        var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

        Assert.False(createResult.Locked);

        await _client.Lock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);

        var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);

        Assert.True(lockResult.Locked);

        await _client.Unlock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);

        var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);

        Assert.False(unlockIssueResult.Locked);
    }