Added test case to iterate over key value pairs.
Also - refactored test code to move key value generation
to a new function.