public async Task AddSshKey() { var generatedKey = RsaSshKey.GenerateQuickest(); using (var context = GetContext()) using (var client = await context.CreateNewUserAsync()) { long keyId; // Create Key { var model = new { Title = context.GetRandomString(), Key = generatedKey.PublicKey, }; var key = await client.AddSshKeyAsync( title : model.Title, key : model.Key); Assert.IsTrue(key.Id > 0); Assert.AreEqual(model.Key, key.Key); Assert.AreEqual(model.Title, key.Title); Assert.AreNotEqual(default, key.CreatedAt);
public async Task AddSshKey() { var generatedKey = RsaSshKey.GenerateQuickest(); using var context = await CreateContextAsync(); using var client = await context.CreateNewUserAsync(); long keyId; var user = await client.Users.GetCurrentUserAsync(); // Create Key var model = new AddSSHKeyToCurrentUserRequest(title: context.GetRandomString(), key: generatedKey.PublicKey); var expectedKey = model.Key; { var key = await client.Users.AddSSHKeyToCurrentUserAsync(model); Assert.True(key.Id > 0); Assert.StartsWith(expectedKey, key.Key, StringComparison.Ordinal); Assert.Equal(model.Title, key.Title); Assert.NotEqual(default, key.CreatedAt);