public void DisplayKeys_Success() { //Arrange Exception exception = null; string lockerFilePath = Path.Combine(TestContext.DeploymentDirectory, "lockerfordisplay.bin"); DisplayArguments arguments = new DisplayArguments { LockerPath = lockerFilePath, Password = "******" }; //Act try { Program.DisplayKeys(arguments); } catch (Exception e) { exception = e; } //Assert Assert.IsNull(exception, $"Was not expecting an exception [{exception}]"); //Check test output for proof that keys are displayed. Should show: //List of Keys and values //---------------------------------------- //somekey somevalue }
public static int DisplayKeys(DisplayArguments arguments) { int result = 0; Locker locker = GetLocker(arguments); System.Console.WriteLine("List of Keys and values"); System.Console.WriteLine("----------------------------------------"); foreach (var pair in locker.Keys) { System.Console.WriteLine($"{pair.Key} {pair.Value}"); } return(result); }