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 (",")); }
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); }
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); }
public void AggregateHistory_SF_FuncNull () { IEnumerable<int> s = new[]{1}; Func<int,int,int> f = null; s.AggregateHistory (f); }