public void RetrieveCredentialCache()
        {
            CredentialCache returnedCache = new CredentialCache();
            var             success       = this.CredentialVault.RetrieveCredentialCache(returnedCache);

            Assert.IsTrue(success, "Failed to retrieve CredentialCache");
            Assert.AreEqual(
                this.CredentialCache.GetResultFromCache(this.ClientId, this.UserId).AccessToken,
                returnedCache.GetResultFromCache(this.ClientId, this.UserId).AccessToken,
                "Failed to get valid access token from CredentialCache");
        }
        public void DeleteStoredCredentialCache()
        {
            var             success       = this.CredentialVault.DeleteStoredCredentialCache();
            CredentialCache returnedCache = new CredentialCache();
            var             failure       = this.CredentialVault.RetrieveCredentialCache(returnedCache);

            Assert.IsTrue(success, "Failed to delete CredentialCache");
            Assert.IsFalse(failure, "CredentialCache was not deleted");
            Assert.IsNull(
                returnedCache.GetResultFromCache(this.ClientId, this.UserId),
                "Failed to clear previous credentials");
        }
        public void RetrieveCredentialCache_SecondaryKeyBytes()
        {
            var vault = new CredentialVault(this.ClientId, this.SecondaryKeyBytes);

            vault.AddCredentialCacheToVault(this.CredentialCache);
            CredentialCache returnedCache = new CredentialCache();
            var             success       = vault.RetrieveCredentialCache(returnedCache);

            Assert.IsTrue(success, "Failed to retrieve CredentialCache");
            Assert.AreEqual(
                this.CredentialCache.GetResultFromCache(this.ClientId, this.UserId).AccessToken,
                returnedCache.GetResultFromCache(this.ClientId, this.UserId).AccessToken,
                "Failed to get valid access token from CredentialCache");
        }