public void TestSerializeMsalAccountCacheItem()
        {
            var    item   = CreateAccountItem();
            string asJson = item.ToJsonString();
            var    item2  = MsalAccountCacheItem.FromJsonString(asJson);

            AssertAccountCacheItemsAreEqual(item, item2);
        }
        public void TestSerializeAccountWithWamId()
        {
            MsalAccountCacheItem item = CreateAccountItem();

            item.WamAccountIds = new Dictionary <string, string>()
            {
                { "client_id_1", "wam_id_1" }, { "client_id_2", "wam_id_2" }
            };
            string asJson = item.ToJsonString();

            Assert.IsTrue(asJson.Contains(@" ""wam_account_ids"": {
    ""client_id_1"": ""wam_id_1"",
    ""client_id_2"": ""wam_id_2""
  }"));

            var item2 = MsalAccountCacheItem.FromJsonString(asJson);

            AssertAccountCacheItemsAreEqual(item, item2);
        }
示例#3
0
 public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
 {
     return(MsalAccountCacheItem.FromJsonString(_accountSharedPreference.GetString(accountKey.ToString(), null)));
 }
示例#4
0
        public void TestMsalAccountCacheItemFromJsonStringEmpty()
        {
            var item = MsalAccountCacheItem.FromJsonString(null);

            Assert.IsNull(item);
        }
示例#5
0
 public List <MsalAccountCacheItem> GetAllAccounts(string optionalPartitionKey = null, ICoreLogger requestlogger = null)
 {
     return(_accountSharedPreference.All.Values.Cast <string>().Select(x => MsalAccountCacheItem.FromJsonString(x)).ToList());
 }
 public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
 {
     return(MsalAccountCacheItem.FromJsonString(GetPayload(accountKey)));
 }
 public IEnumerable <MsalAccountCacheItem> GetAllAccounts()
 {
     return(GetPayloadAsString(MsalCacheKeys.iOSAuthorityTypeToAttrType[CacheAuthorityType.MSSTS.ToString()])
            .Select(x => MsalAccountCacheItem.FromJsonString(x))
            .ToList());
 }
示例#8
0
 public IReadOnlyList <MsalAccountCacheItem> GetAllAccounts()
 {
     return(_accountSharedPreference.All.Values.Cast <string>().Select(x => MsalAccountCacheItem.FromJsonString(x)).ToList());
 }
 public List <MsalAccountCacheItem> GetAllAccounts(string optionalPartitionKey = null, ICoreLogger requestlogger = null)
 {
     return(GetPayloadAsString(MsalCacheKeys.iOSAuthorityTypeToAttrType[CacheAuthorityType.MSSTS.ToString()])
            .Select(x => MsalAccountCacheItem.FromJsonString(x))
            .ToList());
 }