public void AddObjectsTest() { var v1 = (NSString)"1"; var v2 = (NSString)"2"; using (var st = new NSMutableSet <NSString> ()) { Assert.Throws <ArgumentNullException> (() => st.AddObjects((NSString)null), "AddObjects ANE 1"); Assert.Throws <ArgumentNullException> (() => st.AddObjects((NSString[])null), "AddObjects ANE 2"); st.AddObjects(v1); Assert.AreEqual((nuint)1, st.Count, "AddObjects 1 Count"); Assert.IsTrue(st.Contains(v1), "AddObjects 1 Contains"); st.RemoveAll(); st.AddObjects(v1, v1); Assert.AreEqual((nuint)1, st.Count, "AddObjects 2 Count"); Assert.IsTrue(st.Contains(v1), "AddObjects 2 Contains"); st.RemoveAll(); st.AddObjects(v2, v1); Assert.AreEqual((nuint)2, st.Count, "AddObjects 3 Count"); Assert.IsTrue(st.Contains(v1), "AddObjects 3 Contains a"); Assert.IsTrue(st.Contains(v2), "AddObjects 3 Contains b"); } }
public async Task<NSSet> GetRegisteredCategoriesAsync() { var categories = new NSMutableSet(); List<IApnsCategoryProvider> providers; lock (_lock) { providers = _providers.ToList(); } foreach (var provider in providers.ToList()) { categories.AddObjects((await provider.GetCategoriesAsync()).ToArray()); } return categories; }