Example #1
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

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

                await Assert.ThrowsAsync<ArgumentException>(() => client.Unlock("", "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Unlock("owner", "", 1));
            }
            public void PostsToCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.Unlock("fake", "repo", 42);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/lock"), Arg.Any <object>(), Arg.Is <string>(u => u.ToString() == "application/vnd.github.the-key-preview+json"));
            }
            public void PostsToCorrectUrlWithApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.Unlock(1, 42);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/lock"));
            }
            public void PostsToCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                client.Unlock("fake", "repo", 42);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/lock"));
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Unlock(null, "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Unlock("", "name", 1));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Unlock("owner", null, 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Unlock("owner", "", 1));
            }
            public void PostsToCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.Unlock("fake", "repo", 42);

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/lock"), Arg.Any<object>(), Arg.Is<string>(u => u.ToString() == "application/vnd.github.the-key-preview+json"));
            }