Exemplo n.º 1
0
		public void AggregateReverseHistory ()
		{
			IEnumerable<int> s = new []{1, 2, 3, 4, 5};
			Assert.AreEqual (
					"5,1,-2,-4,-5",
					s.AggregateReverseHistory ((a,b) => a - b).Implode (","));
			Assert.AreEqual (
					",5,54,543,5432,54321",
					s.AggregateReverseHistory (new StringBuilder (), (a,b) => a.Append (b)).Implode (","));
			Assert.AreEqual ("1",
					new int[]{}.AggregateReverseHistory (1, (a,b) => a+b).Implode (","));
			Assert.AreEqual (
					"R,R5,R54,R543,R5432,R54321",
					s.AggregateReverseHistory (new StringBuilder (), 
						(a,b) => a.Append (b), 
						a => "R" + a.ToString ()).Implode (","));
			Assert.AreEqual ("1",
					new int[]{}.AggregateReverseHistory (1, (a,b) => a+b, x => x).Implode (","));
		}
Exemplo n.º 2
0
		public void AggregateReverseHistory_SSFR_FuncNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = null;
			Func<int,int>     r = x => x;
			s.AggregateReverseHistory (0, f, r);
		}
Exemplo n.º 3
0
		public void AggregateReverseHistory_SSFR_ResultNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = (a,b) => a-b;
			Func<int,int>     r = null;
			s.AggregateReverseHistory (0, f, r);
		}
Exemplo n.º 4
0
		public void AggregateReverseHistory_SF_FuncNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = null;
			s.AggregateReverseHistory (f);
		}