public void TestAddPublicKey() { var controller = new KvkController(new Mock <IKvkRepository>().Object); controller.AddPublicKey("123456789", "asdfghjkl"); Assert.AreEqual("asdfghjkl", PublicKeyResolver.GetPublicKey("123456789")); }
/// <inheritdoc /> public async Task <JsonObject> GetByKvkNumberAsync(string kvkNumber) { var request = new RestRequest($"api/Handelsregister/by-kvknumber/{kvkNumber}", Method.GET); request.AddHeader("Authorization", "Token Ax&=^tx&5EM4$5jP"); var response = await this.Client.ExecuteTaskAsync(request); if (response.StatusCode == HttpStatusCode.OK) { var result = JsonConvert.DeserializeObject <JsonObject>(response.Content); var publicKey = PublicKeyResolver.GetPublicKey(kvkNumber); if (!string.IsNullOrEmpty(publicKey)) { result.Add("publicKey", publicKey); } return(result); } throw new ApiException(response); }
public void TestReadingKeyShouldReturnKeyIfFound() { PublicKeyResolver.Add("123456789", "asdfghjkl"); Assert.AreEqual("asdfghjkl", PublicKeyResolver.GetPublicKey("123456789")); }