Пример #1
0
        public void RemovingNumberFromEmptyHashSetThrows()
        {
            var value   = Fixture.Create <int>();
            var hashSet = new HashSet <int>();
            var sut     = new HashSetGenericTemplateMethod();

            Assert.Throws <InvalidOperationException>(() => sut.RemoveFromParent(hashSet, value));
        }
Пример #2
0
        public void AddingAndRemovingNumberFromHashSet()
        {
            var value   = Fixture.Create <int>();
            var hashSet = new HashSet <int>();
            var sut     = new HashSetGenericTemplateMethod();

            sut.AddToParent(hashSet, value);
            sut.RemoveFromParent(hashSet, value);

            Assert.AreEqual(0, hashSet.Count);
        }
Пример #3
0
        public void AddingMovingAndRemovingIntFromOneHashSetToAnother()
        {
            var value    = 16;
            var hashSet1 = new HashSet <int>();
            var hashSet2 = new HashSet <int>();
            var sut      = new HashSetGenericTemplateMethod();

            sut.AddToParent(hashSet1, 2);
            sut.AddToParent(hashSet1, 4);
            sut.AddToParent(hashSet1, 8);

            sut.AddToParent(hashSet2, 4);
            sut.AddToParent(hashSet2, 8);
            sut.AddToParent(hashSet2, 12);

            sut.AddToParent(hashSet1, value);
            sut.MoveChildBetweenParents(hashSet1, hashSet2, value);
            sut.RemoveFromParent(hashSet2, value);

            Assert.IsFalse(hashSet1.Contains(value));
            Assert.IsFalse(hashSet2.Contains(value));
        }