/// <summary> /// Create a few keys before testing /// </summary> /// /// <exception cref="System.Exception"></exception> public static void setUpClass() { // create some test key files to use in tests FilePrivateKeyStorage instance = new FilePrivateKeyStorage(); instance.generateKeyPair(new Name("/test/KEY/123"), new RsaKeyParams( 2048)); }
/// <summary> /// Test of generateKeyPair method, of class FilePrivateKeyStorage. /// </summary> /// public void testGenerateAndDeleteKeys() { // create some more key files FilePrivateKeyStorage instance = new FilePrivateKeyStorage(); instance.generateKeyPair(new Name("/test/KEY/temp1"), new RsaKeyParams( 2048)); // check if files created FileInfo[] files = ndnFolder_.listFiles(); int createdFileCount = files.Length; AssertTrue(createdFileCount >= 2); // 2 pre-created + 2 created now + some created by NFD // delete these keys instance.deleteKey(new Name("/test/KEY/temp1")); files = ndnFolder_.listFiles(); int deletedfileCount = files.Length; AssertTrue(createdFileCount - 2 == deletedfileCount); }