Ready for enhancements

We are now to a point where the code makes enough sense that we can begin to work on our change requests. We have broken the random password generation portion of the code into its own method, so now we can work on it independently.

One of the first things we need to do is to stop using Random. Random is, by nature, unpredictable and outside of our control. We need a way to feed the number generation to verify that we can get the expected outputs when Random provides specific inputs.

We will extract an interface and mock class similar to what we did for Console. Here is the first round of tests, the mock class, and the interface that were created.

In the file RandomNumberTests.cs:

public class RandomNumberTests{ private ...

Get Improving your C# Skills now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.