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

                var expectedUri = "user/gpg_keys";
                client.Create(new NewGpgKey("ABCDEFG"));

                connection.Received().Post<GpgKey>(
                    Arg.Is<Uri>(u => u.ToString() == expectedUri),
                    Arg.Any<object>(),
                    Arg.Is<string>(s => s == "application/vnd.github.cryptographer-preview"));
            }
示例#2
0
            public void PassesRequestObject()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserGpgKeysClient(connection);

                var expectedUri = "user/gpg_keys";

                client.Create(new NewGpgKey("ABCDEFG"));

                connection.Received().Post <GpgKey>(
                    Arg.Is <Uri>(u => u.ToString() == expectedUri),
                    Arg.Is <NewGpgKey>(a => a.ArmoredPublicKey == "ABCDEFG"));
            }
示例#3
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserGpgKeysClient(connection);

                var expectedUri = "user/gpg_keys";

                client.Create(new NewGpgKey("ABCDEFG"));

                connection.Received().Post <GpgKey>(
                    Arg.Is <Uri>(u => u.ToString() == expectedUri),
                    Arg.Any <object>());
            }
示例#4
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserGpgKeysClient(connection);

                var expectedUri = "user/gpg_keys";

                client.Create(new NewGpgKey("ABCDEFG"));

                connection.Received().Post <GpgKey>(
                    Arg.Is <Uri>(u => u.ToString() == expectedUri),
                    Arg.Any <object>(),
                    Arg.Is <string>(s => s == "application/vnd.github.cryptographer-preview"));
            }
            public void PassesRequestObject()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserGpgKeysClient(connection);

                var expectedUri = "user/gpg_keys";
                client.Create(new NewGpgKey("ABCDEFG"));

                connection.Received().Post<GpgKey>(
                    Arg.Is<Uri>(u => u.ToString() == expectedUri),
                    Arg.Is<NewGpgKey>(a =>
                        a.ArmoredPublicKey == "ABCDEFG"),
                    Arg.Any<string>());
            }
 public async Task EnsuresNonNullArgument()
 {
     var client = new UserGpgKeysClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null));
 }
示例#7
0
 public async Task EnsuresNonNullArgument()
 {
     var client = new UserGpgKeysClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null));
 }