public void WindowsCredentialManager_Remove_KeyNotFound_ReturnsFalse()
        {
            WindowsCredentialManager credManager = WindowsCredentialManager.OpenDefault();

            // Unique key; guaranteed not to exist!
            string key = Guid.NewGuid().ToString("N");

            bool result = credManager.Remove(key);

            Assert.False(result);
        }
        public void WindowsCredentialManager_Get_KeyNotFound_ReturnsNull()
        {
            WindowsCredentialManager credManager = WindowsCredentialManager.OpenDefault();

            // Unique key; guaranteed not to exist!
            string key = Guid.NewGuid().ToString("N");

            ICredential credential = credManager.Get(key);

            Assert.Null(credential);
        }
        public void WindowsCredentialManager_ReadWriteDelete()
        {
            WindowsCredentialManager credManager = WindowsCredentialManager.OpenDefault();

            const string key        = "secretkey";
            const string userName   = "******";
            const string password   = "******";
            var          credential = new Credential(userName, password);

            // Write
            credManager.AddOrUpdate(key, credential);

            // Read
            ICredential outCredential = credManager.Get(key);

            Assert.NotNull(outCredential);
            Assert.Equal(credential.UserName, outCredential.UserName);
            Assert.Equal(credential.Password, outCredential.Password);

            // Delete
            credManager.Remove(key);
        }