Пример #1
0
		public void RemoveStandAloneElement()
		{
			// Arrange
			var sut = new OrderedRangedSet<int>();
			int[] arr = new [] { 1234, 123, 456, 5678, 789 };
			foreach(int v in arr) sut.Add(v);

			// Act
			sut.Remove(arr[2]);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length - 1));
			Assert.That(sut, Is.EquivalentTo(arr.Where(i => i != arr[2]).OrderBy(i => i)));
			foreach(int v in arr.Where(i => i != arr[2]))
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Where(i => i != arr[2]).Select(i => new Interval<int>(i, i + 1))));
		}
Пример #2
0
		public void RemoveStandAloneElement()
		{
			// Arrange
			var sut = new CodePointSet();
			var arr = new [] { new CodePoint(1234), new CodePoint(123), new CodePoint(456), new CodePoint(5678), new CodePoint(789) };
			foreach(var v in arr) sut.Add(v);

			// Act
			sut.Remove(arr[2]);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length - 1));
			Assert.That(sut, Is.EquivalentTo(arr.Where(i => i != arr[2]).OrderBy(i => i)));
			foreach(var v in arr.Where(i => i != arr[2]))
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Where(i => i != arr[2]).Select(i => new CodePointRange(i, i))));
		}