public void Crypto_IsTheSameInstancePassedToTheConstructor() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); Assert.That(asyncCrypto.Crypto, Is.SameAs(_cryptoMock.Object)); }
public void DecryptAsync_string_ReturnsACompletedTask() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encryptTask = asyncCrypto.DecryptAsync("stuff", "foo", default(CancellationToken)); Assert.That(encryptTask.IsCompleted, Is.True); }
public void EncryptAsync_bytearray_ReturnsTheResultReturnedByCryptoEncrypt() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encrypted = asyncCrypto.EncryptAsync(new byte[0], "foo", default(CancellationToken)).Result; Assert.That(encrypted, Is.EqualTo(Encoding.UTF8.GetBytes("foo"))); }
public void EncryptAsync_bytearray_ReturnsACompletedTask() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encryptTask = asyncCrypto.EncryptAsync(new byte[0], "foo", default(CancellationToken)); Assert.That(encryptTask.IsCompleted, Is.True); }
public void EncryptAsync_string_ReturnsTheResultReturnedByCryptoEncrypt() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encrypted = asyncCrypto.EncryptAsync("stuff", "foo", default(CancellationToken)).Result; Assert.That(encrypted, Is.EqualTo("EncryptedString : foo")); }
public void GetDecryptorAsync_ReturnsASynchronousAsyncDecryptor() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var decryptor = asyncCrypto.GetAsyncDecryptor("foo"); Assert.That(decryptor, Is.InstanceOf <SynchronousAsyncDecryptor>()); }
public void GetDecryptorAsync_ReturnsASynchronousAsyncDecryptorWhoseDecryptorIsTheOneReturnedByACallToTheCryptoGetDecryptorMethod() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var decryptor = (SynchronousAsyncDecryptor)asyncCrypto.GetAsyncDecryptor("foo"); Assert.That(decryptor.Decryptor, Is.SameAs(_decryptor)); }
public void EncryptAsync_bytearray_ReturnsTheResultReturnedByCryptoEncrypt() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encrypted = asyncCrypto.EncryptAsync(new byte[0], "foo").Result; //Assert.AreEqual(encrypted, Encoding.UTF8.GetBytes("foo")); }
public void DecryptAsync_string_ReturnsACompletedTask() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encryptTask = asyncCrypto.DecryptAsync("stuff", "foo"); Assert.IsTrue(encryptTask.IsCompleted); }
public void EncryptAsync_bytearray_ReturnsACompletedTask() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encryptTask = asyncCrypto.EncryptAsync(new byte[0], "foo"); Assert.IsTrue(encryptTask.IsCompleted); }
public void EncryptAsync_string_ReturnsTheResultReturnedByCryptoEncrypt() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encrypted = asyncCrypto.EncryptAsync("stuff", "foo").Result; Assert.AreEqual(encrypted, "EncryptedString : foo"); }
public void GetDecryptorAsync_ReturnsASynchronousAsyncDecryptor() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var decryptor = asyncCrypto.GetAsyncDecryptor("foo"); Assert.AreNotEqual(decryptor, typeof(SynchronousAsyncDecryptor)); }
public void GetEncryptorAsync_ReturnsASynchronousAsyncEncryptorWhoseEncryptorIsTheOneReturnedByACallToTheCryptoGetEncryptorMethod() { Setup("foo"); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); var encryptor = (SynchronousAsyncEncryptor)asyncCrypto.GetAsyncEncryptor("foo"); Assert.AreEqual(encryptor.Encryptor, _encryptor); }
public void CanDecrypt_ReturnsTheSameThingAsACallToCryptoCanDecrypt() { Setup("foo"); Assume.That(_cryptoMock.Object.CanDecrypt("foo"), Is.True); Assume.That(_cryptoMock.Object.CanDecrypt("bar"), Is.False); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); Assert.That(asyncCrypto.CanDecrypt("foo"), Is.True); Assert.That(asyncCrypto.CanDecrypt("bar"), Is.False); }
public void CanDecrypt_ReturnsTheSameThingAsACallToCryptoCanDecrypt() { Setup("foo"); Assert.IsTrue(_cryptoMock.Object.CanEncrypt("foo")); Assert.IsFalse(_cryptoMock.Object.CanEncrypt("bar")); var asyncCrypto = new SynchronousAsyncCrypto(_cryptoMock.Object); Assert.IsTrue(asyncCrypto.CanEncrypt("foo")); Assert.IsFalse(asyncCrypto.CanEncrypt("bar")); }