public void ShouldSuccessfullyEncryptData() { // Arrange const string testData = "This is a test"; var service = new RSAEncryptionService(); // Act var cipherText = service.EncryptString(testData, _TestData.PublicKey); // Assert Assert.True(!string.IsNullOrWhiteSpace(cipherText)); }
public void ShouldSuccessfullyDecryptData() { // Arrange const string testData = "This is a test"; var service = new RSAEncryptionService(); var cipherText = service.EncryptString(testData, _TestData.PublicKey); // Act var plainText = service.DecryptString(cipherText, _TestData.PrivateKey); // Assert Assert.Equal(testData, plainText); }
public void ShouldReturnBase64EncodedString() { // Arrange const string testData = "This is a test"; var service = new RSAEncryptionService(); var cipherText = service.EncryptString(testData, _TestData.PublicKey); // Act var bytes = Convert.FromBase64String(cipherText); // Assert Assert.True(bytes.Length > 0); }