示例#1
0
        /// <summary>
        /// To update the name of an SSH key.
        /// </summary>
        public Task <Key> Update(object keyIdOrFingerprint, Models.Requests.UpdateKey updateKey)
        {
            var parameters = new List <Parameter> {
                new Parameter("id", keyIdOrFingerprint, ParameterType.UrlSegment)
            };

            return(_connection.ExecuteRequest <Key>("account/keys/{id}", parameters, updateKey, "ssh_key", Method.PUT));
        }
示例#2
0
        public void CorrectRequestForUpdateId()
        {
            var factory = Substitute.For <IConnection>();
            var client  = new KeysClient(factory);

            var body = new Models.Requests.UpdateKey {
                Name = "example"
            };

            client.Update(9001, body);

            var parameters = Arg.Is <List <Parameter> >(list => (int)list[0].Value == 9001);

            factory.Received().ExecuteRequest <Key>("account/keys/{id}", parameters, body, "ssh_key", Method.PUT);
        }