public void VerifyDefaultConfigurationBinding() { AESCryptoDelegateConfig expectedConfig = new AESCryptoDelegateConfig() { KeySize = AESCryptoDelegateConfig.DefaultKeySize, }; var myConfiguration = new Dictionary <string, string> { //test empty configuration }; var configuration = new ConfigurationBuilder() .AddInMemoryCollection(myConfiguration) .Build(); AESCryptoDelegate aesDelegate = new AESCryptoDelegate( new Mock <ILogger <AESCryptoDelegate> >().Object, configuration); Assert.True(expectedConfig.IsDeepEqual(aesDelegate.AesConfig)); }
public void VerifyConfigurationBinding() { AESCryptoDelegateConfig expectedConfig = new AESCryptoDelegateConfig() { KeySize = 256, IV = Convert.ToBase64String(Encoding.ASCII.GetBytes("0123456789ABCDEF")), }; var myConfiguration = new Dictionary <string, string> { { "AESCrypto:KeySize", expectedConfig.KeySize.ToString() }, { "AESCrypto:IV", Convert.ToBase64String(Encoding.ASCII.GetBytes("0123456789ABCDEF")) }, }; var configuration = new ConfigurationBuilder() .AddInMemoryCollection(myConfiguration) .Build(); AESCryptoDelegate aesDelegate = new AESCryptoDelegate( new Mock <ILogger <AESCryptoDelegate> >().Object, configuration); Assert.True(expectedConfig.IsDeepEqual(aesDelegate.AesConfig)); }