Beispiel #1
0
        public void EqualTo_2IntListsDifferent_False()
        {
            var list1 = new List <int> {
                0, 1, 2
            };
            var list2 = new List <int> {
                0, 1, 100
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsFalse(isEqual);
        }
Beispiel #2
0
        public void EqualTo_2IntListsSame_True()
        {
            var list1 = new List <int> {
                0, 1, 2
            };
            var list2 = new List <int> {
                0, 1, 2
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsTrue(isEqual);
        }
Beispiel #3
0
        public void EqualTo_2StringListsDifferentLengths_False()
        {
            var list1 = new List <string> {
                "a", "b", "c"
            };
            var list2 = new List <string> {
                "a", "b"
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsFalse(isEqual);
        }
Beispiel #4
0
        public void EqualTo_2StringLists_True()
        {
            var list1 = new List <string> {
                "a", "b", "c"
            };
            var list2 = new List <string> {
                "a", "b", "c"
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsTrue(isEqual);
        }
        private void TimeEntries_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var trackingItem = sender as IChangeTracking;

            if (trackingItem != null)
            {
                _changeTracker["TimeEntries"] = trackingItem.IsChanged;
                OnPropertyChanged("IsChanged");
            }
            else
            {
                _changeTracker["TimeEntries"] = !ListUtility.EqualTo(OriginalTimeEntries, TimeEntries);
                OnPropertyChanged("IsChanged");
            }
        }
        private void RequiredHours_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var trackingItem = sender as IChangeTracking;

            if (trackingItem != null)
            {
                _changeTracker["RequiredHours"] = trackingItem.IsChanged;
                OnPropertyChanged("IsChanged");
            }
            else
            {
                _changeTracker["RequiredHours"] = !ListUtility.EqualTo(OriginalRequiredHours, RequiredHours);
                OnPropertyChanged("IsChanged");
            }
        }
        private void NonProjectActivityItems_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var trackingItem = sender as IChangeTracking;

            if (trackingItem != null)
            {
                _changeTracker["NonProjectActivityItems"] = trackingItem.IsChanged;
                OnPropertyChanged("IsChanged");
            }
            else
            {
                _changeTracker["NonProjectActivityItems"] = !ListUtility.EqualTo(OriginalNonProjectActivityItems, NonProjectActivityItems);
                OnPropertyChanged("IsChanged");
            }
        }
        private void DummyValueTypeCollection_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var trackingItem = sender as IChangeTracking;

            if (trackingItem != null)
            {
                _changeTracker["DummyValueTypeCollection"] = trackingItem.IsChanged;
                OnPropertyChanged("IsChanged");
            }
            else
            {
                _changeTracker["DummyValueTypeCollection"] = !ListUtility.EqualTo(OriginalDummyValueTypeCollection, DummyValueTypeCollection);
                OnPropertyChanged("IsChanged");
            }
        }
Beispiel #9
0
        public void EqualTo_2DummyListsDifferent_False()
        {
            var list1 = new List <DummyObject> {
                new DummyObject {
                    Field1 = "a", Field2 = 0
                }, new DummyObject {
                    Field1 = "b", Field2 = 1
                }
            };
            var list2 = new List <DummyObject> {
                new DummyObject {
                    Field1 = "a", Field2 = 0
                }, new DummyObject {
                    Field1 = "b", Field2 = 100
                }
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsFalse(isEqual);
        }
Beispiel #10
0
        public void EqualTo_2DummyListsSame_True()
        {
            var list1 = new List <DummyObject> {
                new DummyObject {
                    Field1 = "a", Field2 = 0
                }, new DummyObject {
                    Field1 = "b", Field2 = 1
                }
            };
            var list2 = new List <DummyObject> {
                new DummyObject {
                    Field1 = "a", Field2 = 0
                }, new DummyObject {
                    Field1 = "b", Field2 = 1
                }
            };
            var isEqual = ListUtility.EqualTo(list1, list2);

            Assert.IsTrue(isEqual);
        }
        private void TimeEntries_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Remove:
            case NotifyCollectionChangedAction.Replace:
                foreach (var item in e.OldItems)
                {
                    var propertyChangedItem = item as INotifyPropertyChanged;
                    if (propertyChangedItem != null)
                    {
                        propertyChangedItem.PropertyChanged -= TimeEntries_Item_PropertyChanged;
                        // always treat a remove or replace on a reference type as a change
                        _changeTracker["ProjectTimeItems"] = true;
                    }
                    else
                    {
                        _changeTracker["TimeEntries"] = !ListUtility.EqualTo(OriginalTimeEntries, TimeEntries);
                    }
                    OnPropertyChanged("IsChanged");
                }
                break;

            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    var propertyChangedItem = item as INotifyPropertyChanged;
                    if (propertyChangedItem != null)
                    {
                        propertyChangedItem.PropertyChanged += TimeEntries_Item_PropertyChanged;
                    }
                }
                _changeTracker["TimeEntries"] = !ListUtility.EqualTo(OriginalTimeEntries, TimeEntries);
                OnPropertyChanged("IsChanged");
                break;
            }
        }