public void It_removes_all_items() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(collection.Count, Is.GreaterThan(0)); collection.Clear(); Assert.That(collection.Count, Is.EqualTo(0)); }
public void It_invokes_CollectionChanged() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); NotifyCollectionChangedEventArgs collectionChangedEventArgs = null; collection.CollectionChanged += (sender, args) => { collectionChangedEventArgs = args; }; collection.Clear(); Assert.That(collectionChangedEventArgs.Action, Is.EqualTo(NotifyCollectionChangedAction.Reset)); }
public void It_invokes_PropertyChanged() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); var propertyChangedEventArgs = new List <PropertyChangedEventArgs>(); ((INotifyPropertyChanged)collection).PropertyChanged += (sender, args) => { propertyChangedEventArgs.Add(args); }; collection.Clear(); Assert.That(propertyChangedEventArgs.Count, Is.EqualTo(2)); Assert.That(propertyChangedEventArgs.Any(p => p.PropertyName.Equals("Count")), Is.True); Assert.That(propertyChangedEventArgs.Any(p => p.PropertyName.Equals("Item[]")), Is.True); }
/// <summary> /// Method for refreshing local Companies cache. /// </summary> public void RefreshCache(string orderByField = null) { _orderByField = orderByField; Context.Refresh(RefreshMode.StoreWins, Context.Companies); if (_companiesCache == null) { _companiesCache = new SynchronizedObservableCollection <Company>(new ObservableCollection <Company>()); } _companiesCache.Clear(); foreach (Company company in orderCompaniesByField(orderByField)) { _companiesCache.Add(company); } }
public void Clear() => _endpoints.Clear();
public void Reset() { _carPartCollections.Clear(); _strings.Clear(); _slotOverrideData = null; }
public void Clear() { _callHistory.ToList().ForEach(i => i.PropertyChanged -= PropChangedHandler); _callHistory.Clear(); }
public void Reset() { _carRecords.Clear(); }