示例#1
0
        private Set4 NewSet(string firstElement)
        {
            Set4 set = new Set4();

            set.Add(firstElement);
            return(set);
        }
示例#2
0
		public virtual void TestContainsAll()
		{
			Set4 set = NewSet("42");
			set.Add("foo");
			Assert.IsTrue(set.ContainsAll(NewSet("42")));
			Assert.IsTrue(set.ContainsAll(NewSet("foo")));
			Assert.IsTrue(set.ContainsAll(set));
			Set4 other = new Set4(set);
			other.Add("bar");
			Assert.IsFalse(set.ContainsAll(other));
		}
示例#3
0
        public virtual void TestContainsAll()
        {
            Set4 set = NewSet("42");

            set.Add("foo");
            Assert.IsTrue(set.ContainsAll(NewSet("42")));
            Assert.IsTrue(set.ContainsAll(NewSet("foo")));
            Assert.IsTrue(set.ContainsAll(set));
            Set4 other = new Set4(set);

            other.Add("bar");
            Assert.IsFalse(set.ContainsAll(other));
        }
示例#4
0
		private Set4 NewSet(string firstElement)
		{
			Set4 set = new Set4();
			set.Add(firstElement);
			return set;
		}
		private void TstWithContainerStateToPrevail(Set4 containers)
		{
			_containerStateToPrevail = containers;
			RunCurrentCombination();
		}
示例#6
0
        public virtual void TestSingleElementIteration()
        {
            Set4 set = NewSet("first");

            Assert.AreEqual("first", Iterators.Next(set.GetEnumerator()));
        }
		private void TstWithNewObjectsIn(Set4 containersWithNewObjects)
		{
			_containersWithNewObjects = containersWithNewObjects;
			TstWithChangedObjectsIn(None);
			TstWithChangedObjectsIn(_setA);
			TstWithChangedObjectsIn(_setB);
			TstWithChangedObjectsIn(_setBoth);
		}
		private void TstWithChangedObjectsIn(Set4 containers)
		{
			_containersWithChangedObjects = containers;
			TstWithContainerStateToPrevail(_setA);
			return;
			TstWithContainerStateToPrevail(None);
			TstWithContainerStateToPrevail(_setA);
			TstWithContainerStateToPrevail(_setB);
			TstWithContainerStateToPrevail(null);
		}
		private void TstQueryingFrom(Set4 containersToQueryFrom)
		{
			_containersToQueryFrom = containersToQueryFrom;
			TstWithNewObjectsIn(None);
			TstWithNewObjectsIn(_setA);
			TstWithNewObjectsIn(_setB);
			TstWithNewObjectsIn(_setBoth);
		}
		private void TstDirection(Set4 direction)
		{
			_direction = direction;
			TstQueryingFrom(_setA);
			TstQueryingFrom(_setB);
			TstQueryingFrom(_setBoth);
		}
		private void TstWithDeletedObjectsIn(Set4 containers)
		{
			_containersWithDeletedObjects = containers;
			TstDirection(_setA);
			TstDirection(_setB);
			TstDirection(_setBoth);
		}
		private string First(Set4 containerSet)
		{
			return First(containerSet.GetEnumerator());
		}
		private string Print(Set4 containerSet)
		{
			if (containerSet == null)
			{
				return "null";
			}
			if (containerSet.IsEmpty())
			{
				return "NONE";
			}
			if (containerSet.Size() == 2)
			{
				return "BOTH";
			}
			return First(containerSet);
		}