コード例 #1
0
            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));
            }
コード例 #2
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));
            }
コード例 #3
0
            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);
            }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
 public void Clear() => _endpoints.Clear();
コード例 #6
0
ファイル: CarPartService.cs プロジェクト: NFSTools/Aaron
 public void Reset()
 {
     _carPartCollections.Clear();
     _strings.Clear();
     _slotOverrideData = null;
 }
コード例 #7
0
 public void Clear()
 {
     _callHistory.ToList().ForEach(i => i.PropertyChanged -= PropChangedHandler);
     _callHistory.Clear();
 }
コード例 #8
0
ファイル: CarService.cs プロジェクト: NFSTools/Aaron
 public void Reset()
 {
     _carRecords.Clear();
 }