My boss wants me to unit test this License controller for our ASP.NET application.
The problem im having is that normally you go to the application create a license that license is tied to the current instance of a keygenerator and keypair (from portable=license library ) i have a static class called LicenseService that creates a keygenerator and keypair when called. So you generate a license and then go to the verification page, which is on the same instance of the keygenerator and keypair. So the verify will go through, if the license was created on another instance it won't verify (different public/private key) what would be a possible work around for this?
because Im unit testing a valid license and invalid license so i need to have created a license beforehand but each license is tied to a unique instance, so passing a license created with a different key pair to another instance (with its own keypair) will be invalid (even if the license itself is invalid).
here are some ideas i have
hard code the keys (im testing locally so it shouldnt be too much of an issue) but i feel there is a security flaw with this
somehow force the controller and all subsequent instances of the controller to use one specific instance of the generator while having multiple key pairs (this seems very hard and im unsure as to how to approach it)
this is the library btw
http://dev.nauck-it.de/projects/portable-licensing/wiki/GettingStarted