public GetItems ( ICollection |
||
itemIDs | ICollection |
IDs of the items to retrieve |
Résultat | GW2PAO.API.Data.Entities.Item>.IDictionary |
public void CommerceService_GetItems_ByID_SomeInvalid() { CommerceService cs = new CommerceService(); // Create the collection of items List<int> ids = new List<int>(); for (int i = 0; i > -50; i--) ids.Add(i); ids.AddRange(cs.ItemsDB.Keys.Take(100)); for (int i = -150; i > -200; i--) ids.Add(i); var sw = new Stopwatch(); sw.Start(); var items = cs.GetItems(ids); sw.Stop(); Console.WriteLine("To retrieve details {0} items using a valid and invalid IDs, it took {1}ms", ids.Count, sw.ElapsedMilliseconds); Assert.IsNotNull(items); Assert.AreEqual(100, items.Count); foreach (var item in items) { var itemFromDb = cs.ItemsDB.FirstOrDefault(i => i.Key == item.Key); Assert.IsNotNull(itemFromDb); Assert.AreEqual(itemFromDb.Key, item.Value.ID); Assert.AreEqual(itemFromDb.Value.ID, item.Value.ID); Assert.AreEqual(itemFromDb.Value.Name, item.Value.Name); Assert.AreEqual(itemFromDb.Value.Rarity, item.Value.Rarity); Assert.AreEqual(itemFromDb.Value.Level, item.Value.LevelRequirement); } }
public void CommerceService_GetItems_ByID_AllInvalid() { CommerceService cs = new CommerceService(); // Create the collection of items List<int> ids = new List<int>(); for (int i = 0; i > -200; i--) ids.Add(i); var sw = new Stopwatch(); sw.Start(); var items = cs.GetItems(ids); sw.Stop(); Console.WriteLine("To retrieve details {0} items using invalid IDs, it took {1}ms", ids.Count, sw.ElapsedMilliseconds); Assert.IsNotNull(items); Assert.AreEqual(0, items.Count); }