Exemplo n.º 1
0
		public void AggregateHistory ()
		{
			IEnumerable<int> s = new []{1, 2, 3, 4, 5};
			Assert.AreEqual (
					"1,-1,-4,-8,-13",
					s.AggregateHistory ((a,b) => a - b).Implode (","));
			Assert.AreEqual (
					",1,12,123,1234,12345",
					s.AggregateHistory (new StringBuilder (), (a,b) => a.Append (b)).Implode (","));
			Assert.AreEqual ("1",
					new int[]{}.AggregateHistory (1, (a,b) => a+b).Implode (","));
			Assert.AreEqual (
					"R,R1,R12,R123,R1234,R12345",
					s.AggregateHistory (new StringBuilder (), 
						(a,b) => a.Append (b), 
						a => "R" + a.ToString ()).Implode (","));
			Assert.AreEqual ("1",
					new int[]{}.AggregateHistory (1, (a,b) => a+b, x => x).Implode (","));
		}
Exemplo n.º 2
0
		public void AggregateHistory_SSFR_FuncNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = null;
			Func<int,int>     r = x => x;
			s.AggregateHistory (0, f, r);
		}
Exemplo n.º 3
0
		public void AggregateHistory_SSFR_ResultNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = (a,b) => a-b;
			Func<int,int>     r = null;
			s.AggregateHistory (0, f, r);
		}
Exemplo n.º 4
0
		public void AggregateHistory_SF_FuncNull ()
		{
			IEnumerable<int>  s = new[]{1};
			Func<int,int,int> f = null;
			s.AggregateHistory (f);
		}