Пример #1
0
        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
        }
Пример #2
0
        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);
        }