The random number class uses the C# Random class but adds some additional methods to support the requirements. The checksum number class uses checksum routines that are pretty basic. Additional advanced algorithms can be added simply by adding the routine and an enumerated type. ![]() Get/set the property to use the different checksum algorithms.Ĭalculate the checksum based on the selected algorithm. Since so many variations of a license key can be done I did all of the unit tests using NUnit. Another advantage of NUnit was that if I fixed something in one area I could also make sure that I did not break something or another. ![]() Since the keys are using random numbers, I iterated thirty times in many of the tests to make sure the numbers matched. As part of the tests, I also decoded the same key to make sure that whatever I encoded I also decoded the same value. When you open the solution, you will notice there are three projects. One is the library so that when it is built anyone can use it. The second is an interactive test program so that you can test individual license keys and tokens. ![]() ![]() The third is the NUnit project so that you can add, run and debug the unit tests.
0 Comments
Leave a Reply. |