vendredi 6 octobre 2017

Decrypt values for use in testing

I have an SQL connection string I'm trying to use in a data-driven integration test but I don't want to leave it there because I don't want the username and password to find their way into the company repository because security. So, I encrypted it using our secret and the Powershell ISE encryption script. This all worked as expected. Now, I have the string in my .runsettings file and I have gotten it from there using the TestContext object in my ClassInitialize method. This also works without a problem.

The problem occurs when I try to decrypt this value as I have no way of actually doing this.

I know that in our UnityConfig file we take a ServiceContext object which we can use to get ConfigurationProperty objects which have a DecryptValue extension method. However, I don't see a similar method for TestContext objects. So, how do I decrypt my connection string?

Aucun commentaire:

Enregistrer un commentaire