Пример #1
0
 public void CanSkipFilteringWithoutComplaining()
 {
     ItemList fiveItems = CreateItems(5);
     CountFilter filter = new CountFilter(0, 10);
     filter.Filter(fiveItems);
     Assert.AreEqual(5, fiveItems.Count);
 }
Пример #2
0
 public void CanFilter_TwoExessiveItems_WithClassInstance()
 {
     ItemList fiveItems = CreateItems(5);
     CountFilter filter = new CountFilter(0, 3);
     filter.Filter(fiveItems);
     Assert.AreEqual(3, fiveItems.Count);
 }
Пример #3
0
		public void CanFilter_FromEnd()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(7, 3);
			filter.Filter(items);
			Assert.AreEqual(3, items.Count);
			Assert.AreEqual(7, items[0].ID);
			Assert.AreEqual(8, items[1].ID);
			Assert.AreEqual(9, items[2].ID);
		}
Пример #4
0
		public void CanFilter_FromStart()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(0, 3);
			filter.Filter(items);
			Assert.AreEqual(3, items.Count);
			Assert.AreEqual(0, items[0].ID);
			Assert.AreEqual(1, items[1].ID);
			Assert.AreEqual(2, items[2].ID);
		}
Пример #5
0
		public void CanFilter_FromMid()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(4, 3);
			filter.Filter(items);
			Assert.AreEqual(3, items.Count);
			Assert.AreEqual(4, items[0].ID);
			Assert.AreEqual(5, items[1].ID);
			Assert.AreEqual(6, items[2].ID);
		}
Пример #6
0
 public void CanFilter_FirstAndLastItems()
 {
     ItemList fiveItems = CreateItems(5);
     ContentItem toBeFirst = fiveItems[1];
     ContentItem toBeLast = fiveItems[3];
     CountFilter filter = new CountFilter(1, 3);
     filter.Filter(fiveItems);
     Assert.AreEqual(3, fiveItems.Count);
     Assert.AreEqual(toBeFirst, fiveItems[0]);
     Assert.AreEqual(toBeLast, fiveItems[2]);
 }
Пример #7
0
		public void CanFilter_OneElement_FromEnd()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(9, 1);
			filter.Filter(items);
			Assert.AreEqual(1, items.Count);
			Assert.AreEqual(9, items[0].ID);
		}
Пример #8
0
		public void CanFilter_EmptyList_FromStart()
		{
			ItemList items = CreateItems(0);
			CountFilter filter = new CountFilter(3, 2);
			filter.Filter(items);
			Assert.AreEqual(0, items.Count);
		}
Пример #9
0
		public void CanFilter_ZeroElements_FromEnd()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(9, 0);
			filter.Filter(items);
			Assert.AreEqual(0, items.Count);
		}
Пример #10
0
		public void CanFilter_FromEnd_WithInsufficientElements()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(7, 5);
			filter.Filter(items);
			Assert.AreEqual(3, items.Count);
			Assert.AreEqual(7, items[0].ID);
			Assert.AreEqual(8, items[1].ID);
			Assert.AreEqual(9, items[2].ID);
		}
Пример #11
0
		public void CanFilter_FromBeforeStart()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(-10, 3);
			filter.Filter(items);
			Assert.AreEqual(3, items.Count);
		}
Пример #12
0
		public void CanFilter_FromBeyondEnd()
		{
			ItemList items = CreateItems(10);
			CountFilter filter = new CountFilter(10, 3);
			filter.Filter(items);
			Assert.AreEqual(0, items.Count);
		}