public void TestSavePack() { var packDBHelper = new PackDBHelper(); Task <Packs> packs = packDBHelper.GetPacks(Properties.Resources.TestAcct); packs.Wait(); var userPacks = packs.Result; userPacks.Pack = new PackMap() { ClassicCount = 1, FrozenThroneCount = 1, GadgetzanCount = 1, GVGCount = 1, KoboldsCount = 1, OldGodsCount = 1, TGTCount = 1, UnGoroCount = 1 }; Task saved = packDBHelper.SavePack(userPacks); saved.Wait(); Assert.IsNull(saved.Exception); }
/// <summary> /// Increments the pack type for user by the pack counter /// </summary> /// <param name="packCounter">Number of packs opened</param> /// <param name="user">User's model object</param> /// <param name="packType">Pack that was opened</param> private void IncrementPackCount(int packCounter, Packs user, string packType) { var packs = user.Pack; if (PackTypeSynonyms.Classic.Contains(packType.ToLower())) { packs.ClassicCount += packCounter; } if (PackTypeSynonyms.SaviorsOfUldum.Contains(packType.ToLower())) { packs.SaviorsOfUldumCount += packCounter; } if (PackTypeSynonyms.RiseOfShadows.Contains(packType.ToLower())) { packs.RiseOfShadowsCount += packCounter; } if (PackTypeSynonyms.RastakhansRumble.Contains(packType.ToLower())) { packs.RastakhansCount += packCounter; } if (PackTypeSynonyms.Boomsday.Contains(packType.ToLower())) { packs.BoomsdayCount += packCounter; } if (PackTypeSynonyms.UnGoro.Contains(packType.ToLower())) { packs.UnGoroCount += packCounter; } if (PackTypeSynonyms.GVG.Contains(packType.ToLower())) { packs.GVGCount += packCounter; } if (PackTypeSynonyms.Gadgetzan.Contains(packType.ToLower())) { packs.GadgetzanCount += packCounter; } if (PackTypeSynonyms.FrozenThrone.Contains(packType.ToLower())) { packs.FrozenThroneCount += packCounter; } if (PackTypeSynonyms.OldGods.Contains(packType.ToLower())) { packs.OldGodsCount += packCounter; } if (PackTypeSynonyms.TGT.Contains(packType.ToLower())) { packs.TGTCount += packCounter; } Task t = hearthDBHelper.SavePack(user); t.Wait(); }