Exemplo n.º 1
0
            public void RequestsCorrectUrl()
            {
                var endpoint = new Uri("user/keys", UriKind.Relative);
                var client = Substitute.For<IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.GetAllForCurrent();

                client.Received().GetAll<SshKey>(endpoint);
            }
Exemplo n.º 2
0
            public void RequestsCorrectUrl()
            {
                var endpoint      = new Uri("user/keys", UriKind.Relative);
                var client        = Substitute.For <IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.GetAllForCurrent();

                client.Received().GetAll <SshKey>(endpoint);
            }
Exemplo n.º 3
0
            public void SendsCreateToCorrectUrl()
            {
                var endpoint      = new Uri("user/keys/42", UriKind.Relative);
                var client        = Substitute.For <IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.Delete(42);

                client.Received().Delete(endpoint);
            }
Exemplo n.º 4
0
            public void SendsUpdateToCorrectUrl()
            {
                var endpoint = new Uri("user/keys/42", UriKind.Relative);
                var data = new SshKeyUpdate();
                var client = Substitute.For<IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.Update(42, data);

                client.Received().Patch<SshKey>(endpoint, data);
            }
Exemplo n.º 5
0
            public void SendsCreateToCorrectUrl()
            {
                var endpoint      = new Uri("user/keys", UriKind.Relative);
                var data          = new SshKeyUpdate();
                var client        = Substitute.For <IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.Create(data);

                client.Received().Post <SshKey>(endpoint, data);
            }
Exemplo n.º 6
0
 public async Task EnsuresArgumentsNotNull()
 {
     var userEndpoint = new SshKeysClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Update(1, null));
 }
Exemplo n.º 7
0
            public void SendsCreateToCorrectUrl()
            {
                var endpoint = new Uri("user/keys/42", UriKind.Relative);
                var client = Substitute.For<IApiConnection>();
                var sshKeysClient = new SshKeysClient(client);

                sshKeysClient.Delete(42);

                client.Received().Delete(endpoint);
            }
Exemplo n.º 8
0
 public async Task EnsuresArgumentsNotNull()
 {
     var userEndpoint = new SshKeysClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentNullException>(() => userEndpoint.Update(1, null));
 }