public void TestSetCredentialsSimple()
        {
            //
            // SETUP
            //
            Mock <ICredentialWrapper> mockCred = new Mock <ICredentialWrapper>();

            _factoryMock.Setup(x => x.CreateCredential()).Returns(mockCred.Object);

            ConsoleKeyInfo a_key = new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false);
            ConsoleKeyInfo enter = new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false);

            _mockConsole.SetupSequence(x => x.ReadKey(true))
            .Returns(a_key)
            .Returns(enter);

            _mockIdentity.Setup(x => x.Name).Returns("user");
            mockCred.SetupProperty(x => x.Username);
            mockCred.SetupProperty(x => x.SecurePassword);

            //
            // TEST
            //
            bool status = _target.SetCredentials("target");

            //
            // VERIFY
            //
            SecureString expected = new SecureString();

            expected.AppendChar('a');

            mockCred.Object.Username.Should().Be("user");
            CompareSecureStrings(mockCred.Object.SecurePassword, expected).Should().Be(true);
        }
        static void Main(string[] args)
        {
            IPersonalizationManagerUtilityFactory factory = new PersonalizationManagerUtilityFactory();
            PersonalizationManager pmanager = new PersonalizationManager(factory);

            bool status = pmanager.SetCredentials("ConsoleApp");

            (string user, SecureString password) = pmanager.GetCredentials("ConsoleApp");

            var targetBstr   = Marshal.SecureStringToBSTR(password);
            var targetString = Marshal.PtrToStringBSTR(targetBstr);
        }