private void TestGetLastWithRevokedKeyShouldReturnKey() { string key = "some_key"; sharedCryptoKeyMock.Setup(x => x.IsRevoked()).Returns(true); secureCryptoKeyDictionary.PutAndGetUsable(key, sharedCryptoKeyMock.Object); CryptoKey actualCryptoKey = secureCryptoKeyDictionary.GetLast(); Assert.IsType <SharedCryptoKey>(actualCryptoKey); SharedCryptoKey sharedCrypto = (SharedCryptoKey)actualCryptoKey; Assert.Equal(sharedCryptoKeyMock.Object, sharedCrypto.SharedKey); Assert.True(actualCryptoKey.IsRevoked()); }
private void TestPutMultipleAndGetLast() { Mock <CryptoKey> cryptoKey1 = new Mock <CryptoKey>(); Mock <CryptoKey> cryptoKey2 = new Mock <CryptoKey>(); Mock <CryptoKey> cryptoKey3 = new Mock <CryptoKey>(); Mock <CryptoKey> cryptoKey4 = new Mock <CryptoKey>(); Mock <CryptoKey> cryptoKey5 = new Mock <CryptoKey>(); secureCryptoKeyDictionary.PutAndGetUsable("klhjasdffghs", cryptoKey1.Object); secureCryptoKeyDictionary.PutAndGetUsable("zzzzzzzz", cryptoKey2.Object); // should always be last since sorted secureCryptoKeyDictionary.PutAndGetUsable("ghtew", cryptoKey3.Object); secureCryptoKeyDictionary.PutAndGetUsable("asdfasdfasdf", cryptoKey4.Object); secureCryptoKeyDictionary.PutAndGetUsable("aaaaaaaa", cryptoKey5.Object); CryptoKey lastCryptoKey = secureCryptoKeyDictionary.GetLast(); Assert.IsType <SharedCryptoKey>(lastCryptoKey); SharedCryptoKey sharedCrypto = (SharedCryptoKey)lastCryptoKey; Assert.Equal(cryptoKey2.Object, sharedCrypto.SharedKey); }
public void TestConstructor() { SharedCryptoKey sharedCryptoKey = new SharedCryptoKey(sharedKeyMock.Object); Assert.NotNull(sharedCryptoKey); }
public SharedCryptoKeyTest() { sharedKeyMock = new Mock <CryptoKey>(); sharedCryptoKey = new SharedCryptoKey(sharedKeyMock.Object); }