コード例 #1
0
		public void AddManyUnrelatedElements()
		{
			// Arrange
			var sut = new OrderedRangedSet<int>();
			int[] arr = new [] { 1234, 123, 456, 5678, 789 };

			// Act
			foreach(int v in arr)
				sut.Add(v);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length));
			Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
			foreach(int v in arr)
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new Interval<int>(i, i + 1))));
		}
コード例 #2
0
ファイル: CodePointSetTests.cs プロジェクト: Virtlink/noofax
		public void AddManyUnrelatedElements()
		{
			// Arrange
			var sut = new CodePointSet();
			var arr = new [] { new CodePoint(1234), new CodePoint(123), new CodePoint(456), new CodePoint(5678), new CodePoint(789) };

			// Act
			foreach(var v in arr)
				sut.Add(v);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length));
			Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
			foreach(var v in arr)
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new CodePointRange(i, i))));
		}
コード例 #3
0
 public void Sorts_according_to_given_list()
 {
     var l = new[] { "A", "M", "X", "Z" };
     var l2 = l.OrderBy(s => s, _comparer);
     l2.Should().BeEquivalentTo(_template);
 }