public void Contains_works()
        {
            var testData = CreateTestData();
            var hashSet  = new ObservableHashSet <int>(testData);

            foreach (var item in testData)
            {
                Assert.True(hashSet.Contains(item));
            }

            foreach (var item in CreateTestData(1000, 10000).Except(testData))
            {
                Assert.False(hashSet.Contains(item));
            }
        }
        public void Items_set_in_the_binding_list_are_replaced_in_the_ObservableHashSet()
        {
            var item = new ListElement(4);
            var oc   = new ObservableHashSet <ListElement> {
                3, 1, item, 1, 5, 9
            };
            var obbl = new ObservableBackedBindingList <ListElement>(oc);

            var newItem = new ListElement(7);

            obbl[2] = newItem;

            Assert.True(oc.Contains(newItem));
            Assert.False(oc.Contains(item));
        }
        public void Items_inserted_into_the_binding_list_are_added_to_the_ObservableHashSet()
        {
            var oc   = new ObservableHashSet <ListElement>();
            var obbl = new ObservableBackedBindingList <ListElement>(oc);

            var item = new ListElement(7);

            obbl.Insert(0, item);

            Assert.True(oc.Contains(item));
        }
        public void Items_canceled_during_AddNew_are_not_added_to_the_ObservableHashSet()
        {
            var oc   = new ObservableHashSet <ListElement>();
            var obbl = new ObservableBackedBindingList <ListElement>(oc);

            var item = obbl.AddNew();

            obbl.CancelNew(0);

            Assert.False(oc.Contains(item));
        }
        public void Items_added_to_the_binding_list_with_AddNew_are_added_to_the_ObservableHashSet()
        {
            var oc   = new ObservableHashSet <ListElement>();
            var obbl = new ObservableBackedBindingList <ListElement>(oc);

            var item = obbl.AddNew();

            obbl.EndNew(0);

            Assert.True(oc.Contains(item));
        }
        public void Items_removed_by_index_from_the_binding_list_are_removed_from_the_ObservableHashSet()
        {
            var item = new ListElement(4);
            var oc   = new ObservableHashSet <ListElement> {
                3, 1, item, 1, 5, 9
            };
            var obbl = new ObservableBackedBindingList <ListElement>(oc);

            obbl.RemoveAt(2);

            Assert.False(oc.Contains(item));
        }