Add UnitTest for KeyMacro.cs
+Modification for some errors