public void Run(RegressionEnvironment env) { string[] fields = "c0".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.reverse()"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E3,1")) .Verify("c0", val => AssertST0Id(val, "E3,E2,E1")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E2,9", "E1,1")) .Verify("c0", val => AssertST0Id(val, "E1,E2")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1")) .Verify("c0", val => AssertST0Id(val, "E1")); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Verify("c0", val => AssertST0Id(val, null)); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Verify("c0", val => AssertST0Id(val, "")); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.arrayOf(x => x.P00)"); builder.WithExpression(fields[1], "Contained.arrayOf((x, i) => x.P00 + i*10)"); builder.WithExpression(fields[2], "Contained.arrayOf((x, i, s) => x.P00 + i*10 + s*100)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(int?[]))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E2,2")) .Expect(fields, IntArray(1, 9, 2), IntArray(1, 19, 22), IntArray(301, 319, 322)); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Expect(fields, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Expect(fields, IntArray(), IntArray(), IntArray()); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,9")) .Expect(fields, IntArray(9), IntArray(9), IntArray(109)); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.countof()"); builder.WithExpression(fields[1], "Contained.countof(x => x.P00 = 9)"); builder.WithExpression(fields[2], "Contained.countof((x, i) => x.P00 + i = 10)"); builder.WithExpression(fields[3], "Contained.countof((x, i, s) => x.P00 + i + s = 100)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(int?))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E2,9")).Expect(fields, 3, 2, 1, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()).Expect(fields, 0, 0, 0, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,9")).Expect(fields, 1, 1, 0, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1")).Expect(fields, 1, 0, 0, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,10", "E2,9")).Expect(fields, 2, 1, 2, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,98", "E2,97")).Expect(fields, 2, 0, 0, 2); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.orderBy( (x, i) => case when i <= 2 then P00 else i-10 end)"); builder.WithExpression(fields[1], "Contained.orderByDesc( (x, i) => case when i <= 2 then P00 else i-10 end)"); builder.WithExpression(fields[2], "Contained.orderBy( (x, i, s) => case when s <= 2 then P00 else i-10 end)"); builder.WithExpression(fields[3], "Contained.orderByDesc( (x, i, s) => case when s <= 2 then P00 else i-10 end)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,2")) .Verify("c0", val => AssertST0Id(val, "E1,E2")) .Verify("c1", val => AssertST0Id(val, "E2,E1")) .Verify("c2", val => AssertST0Id(val, "E1,E2")) .Verify("c3", val => AssertST0Id(val, "E2,E1")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,2", "E3,3", "E4,4")) .Verify("c0", val => AssertST0Id(val, "E4,E1,E2,E3")) .Verify("c1", val => AssertST0Id(val, "E3,E2,E1,E4")) .Verify("c2", val => AssertST0Id(val, "E1,E2,E3,E4")) .Verify("c3", val => AssertST0Id(val, "E4,E3,E2,E1")); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Verify("c0", val => AssertST0Id(val, "")) .Verify("c1", val => AssertST0Id(val, "")) .Verify("c2", val => AssertST0Id(val, "")) .Verify("c3", val => AssertST0Id(val, "")); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4,c5".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.mostFrequent(x => P00)"); builder.WithExpression(fields[1], "Contained.leastFrequent(x => P00)"); builder.WithExpression(fields[2], "Contained.mostFrequent( (x, i) => P00 + i*2)"); builder.WithExpression(fields[3], "Contained.leastFrequent( (x, i) => P00 + i*2)"); builder.WithExpression(fields[4], "Contained.mostFrequent( (x, i, s) => P00 + i*2 + s*4)"); builder.WithExpression(fields[5], "Contained.leastFrequent( (x, i, s) => P00 + i*2 + s*4)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(int?))); SupportBean_ST0_Container bean = SupportBean_ST0_Container.Make2Value("E1,12", "E2,11", "E2,2", "E3,12"); builder.WithAssertion(bean).Expect(fields, 12, 11, 12, 12, 28, 28); bean = SupportBean_ST0_Container.Make2Value("E1,12"); builder.WithAssertion(bean).Expect(fields, 12, 12, 12, 12, 16, 16); bean = SupportBean_ST0_Container.Make2Value("E1,12", "E2,11", "E2,2", "E3,12", "E1,12", "E2,11", "E3,11"); builder.WithAssertion(bean).Expect(fields, 12, 2, 12, 12, 40, 40); bean = SupportBean_ST0_Container.Make2Value("E2,11", "E1,12", "E2,15", "E3,12", "E1,12", "E2,11", "E3,11"); builder.WithAssertion(bean).Expect(fields, 11, 15, 11, 11, 39, 39); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()).Expect(fields, null, null, null, null, null, null); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.aggregate(0, (result, item) => result + item.P00)"); builder.WithExpression(fields[1], "Contained.aggregate('', (result, item) => result || ', ' || item.Id)"); builder.WithExpression(fields[2], "Contained.aggregate('', (result, item) => result || (case when result='' then '' else ',' end) || item.Id)"); builder.WithExpression(fields[3], "Contained.aggregate(0, (result, item, i) => result + item.P00 + i*10)"); builder.WithExpression(fields[4], "Contained.aggregate(0, (result, item, i, s) => result + item.P00 + i*10 + s*100)"); builder.WithStatementConsumer( stmt => LambdaAssertionUtil.AssertTypes( stmt.EventType, fields, new[] { typeof(int?), typeof(string), typeof(string), typeof(int?), typeof(int?) })); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,12", "E2,11", "E2,2")) .Expect(fields, 25, ", E1, E2, E2", "E1,E2,E2", 12 + 21 + 22, 312 + 321 + 322); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Expect(fields, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value(new string[0])) .Expect(fields, 0, "", "", 0, 0); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,12")) .Expect(fields, 12, ", E1", "E1", 12, 112); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4,c5".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.firstOf(x => P00 = 9)"); builder.WithExpression(fields[1], "Contained.lastOf(x => P00 = 9)"); builder.WithExpression(fields[2], "Contained.firstOf( (x, i) => P00 = 9 and i >= 1)"); builder.WithExpression(fields[3], "Contained.lastOf( (x, i) => P00 = 9 and i >= 1)"); builder.WithExpression(fields[4], "Contained.firstOf( (x, i, s) => P00 = 9 and i >= 1 and s > 2)"); builder.WithExpression(fields[5], "Contained.lastOf((x, i, s) => P00 = 9 and i >= 1 and s > 2)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(SupportBean_ST0))); SupportBean_ST0_Container beanOne = SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E2,9"); builder.WithAssertion(beanOne) .Expect( fields, beanOne.Contained[1], beanOne.Contained[2], beanOne.Contained[1], beanOne.Contained[2], beanOne.Contained[1], beanOne.Contained[2]); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()).Expect(fields, null, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,1", "E2,1")).Expect(fields, null, null, null, null, null, null); SupportBean_ST0_Container beanTwo = SupportBean_ST0_Container.Make2Value("E1,1", "E2,9"); builder.WithAssertion(beanTwo) .Expect( fields, beanTwo.Contained[1], beanTwo.Contained[1], beanTwo.Contained[1], beanTwo.Contained[1], null, null); SupportBean_ST0_Container beanThree = SupportBean_ST0_Container.Make2Value("E2,9", "E1,1"); builder.WithAssertion(beanThree) .Expect( fields, beanThree.Contained[0], beanThree.Contained[0], null, null, null, null); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4,c5".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.take(2)"); builder.WithExpression(fields[1], "Contained.take(1)"); builder.WithExpression(fields[2], "Contained.take(0)"); builder.WithExpression(fields[3], "Contained.take(-1)"); builder.WithExpression(fields[4], "Contained.takeLast(2)"); builder.WithExpression(fields[5], "Contained.takeLast(1)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,2", "E3,3")) .Verify("c0", val => AssertST0Id(val, "E1,E2")) .Verify("c1", val => AssertST0Id(val, "E1")) .Verify("c2", val => AssertST0Id(val, "")) .Verify("c3", val => AssertST0Id(val, "")) .Verify("c4", val => AssertST0Id(val, "E2,E3")) .Verify("c5", val => AssertST0Id(val, "E3")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,2")) .Verify("c0", val => AssertST0Id(val, "E1,E2")) .Verify("c1", val => AssertST0Id(val, "E1")) .Verify("c2", val => AssertST0Id(val, "")) .Verify("c3", val => AssertST0Id(val, "")) .Verify("c4", val => AssertST0Id(val, "E1,E2")) .Verify("c5", val => AssertST0Id(val, "E2")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1")) .Verify("c0", val => AssertST0Id(val, "E1")) .Verify("c1", val => AssertST0Id(val, "E1")) .Verify("c2", val => AssertST0Id(val, "")) .Verify("c3", val => AssertST0Id(val, "")) .Verify("c4", val => AssertST0Id(val, "E1")) .Verify("c5", val => AssertST0Id(val, "E1")); SupportEvalAssertionBuilder assertionEmpty = builder.WithAssertion(SupportBean_ST0_Container.Make2Value()); foreach (string field in fields) { assertionEmpty.Verify(field, val => AssertST0Id(val, "")); } SupportEvalAssertionBuilder assertionNull = builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()); foreach (string field in fields) { assertionNull.Verify(field, val => AssertST0Id(val, null)); } builder.Run(env); }
public void Run(RegressionEnvironment env) { var fields = "c0,c1,c2".SplitCsv(); var builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.where(x => P00 = 9)"); builder.WithExpression(fields[1], "Contained.where((x, i) => x.P00 = 9 and i >= 1)"); builder.WithExpression(fields[2], "Contained.where((x, i, s) => x.P00 = 9 and i >= 1 and s > 2)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection<object>))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E3,1")) .Verify("c0", val => AssertST0Id(val, "E2")) .Verify("c1", val => AssertST0Id(val, "E2")) .Verify("c2", val => AssertST0Id(val, "E2")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,9", "E2,1", "E3,1")) .Verify("c0", val => AssertST0Id(val, "E1")) .Verify("c1", val => AssertST0Id(val, "")) .Verify("c2", val => AssertST0Id(val, "")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,1", "E3,9")) .Verify("c0", val => AssertST0Id(val, "E3")) .Verify("c1", val => AssertST0Id(val, "E3")) .Verify("c2", val => AssertST0Id(val, "E3")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,9", "E3,9")) .Verify("c0", val => AssertST0Id(val, "E1,E3")) .Verify("c1", val => AssertST0Id(val, "E3")) .Verify("c2", val => AssertST0Id(val, "")); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E3,1", "E4,9")) .Verify("c0", val => AssertST0Id(val, "E2,E4")) .Verify("c1", val => AssertST0Id(val, "E2,E4")) .Verify("c2", val => AssertST0Id(val, "E2,E4")); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Verify("c0", Assert.IsNull) .Verify("c1", Assert.IsNull) .Verify("c2", Assert.IsNull); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Verify("c0", val => AssertST0Id(val, "")) .Verify("c1", val => AssertST0Id(val, "")) .Verify("c2", val => AssertST0Id(val, "")); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.firstOf().P00"); builder.WithExpression(fields[1], "Contained.lastOf().P00"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(int?))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,9", "E3,3")).Expect(fields, 1, 3); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1")).Expect(fields, 1, 1); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()).Expect(fields, null, null); builder.Run(env); }
public void Run(RegressionEnvironment env) { string field = "c0"; SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(field, "Contained.selectFrom(x => Id)"); builder.WithStatementConsumer(stmt => AssertTypes(stmt.EventType, "c0", typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,12", "E2,11", "E3,2")) .Verify(field, value => AssertValuesArrayScalar(value, "E1", "E2", "E3")); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Verify(field, Assert.IsNull); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Verify(field, value => AssertValuesArrayScalar(value)); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.groupBy(k => Id, v => P00)"); builder.WithExpression(fields[1], "Contained.groupBy((k, i) => Id || '_' || Convert.ToString(i), (v, i) => P00 + i*10)"); builder.WithExpression( fields[2], "Contained.groupBy((k, i, s) => Id || '_' || Convert.ToString(i) || '_' || Convert.ToString(s), (v, i, s) => P00 + i*10 + s*100)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(IDictionary <object, object>))); EPAssertionUtil.AssertionCollectionValueString extractor = collectionItem => { int p00 = collectionItem.AsInt32(); return(Convert.ToString(p00)); }; builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E1,2", "E2,5")) .Verify("c0", val => CompareMaps(val, "E1,E2", new[] { "1,2", "5" }, extractor)) .Verify("c1", val => CompareMaps(val, "E1_0,E1_1,E2_2", new[] { "1", "12", "25" }, extractor)) .Verify("c2", val => CompareMaps(val, "E1_0_3,E1_1_3,E2_2_3", new[] { "301", "312", "325" }, extractor)); SupportEvalAssertionBuilder assertionNull = builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()); foreach (string field in fields) { assertionNull.Verify(field, Assert.IsNull); } SupportEvalAssertionBuilder assertionEmpty = builder.WithAssertion(SupportBean_ST0_Container.Make2Value()); foreach (string field in fields) { assertionEmpty.Verify(field, val => CompareMaps(val, "", new string[0], GetExtractorScalar())); } builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4,c5".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.allof(v => P00 = 7)"); builder.WithExpression(fields[1], "Contained.anyof(v => P00 = 7)"); builder.WithExpression(fields[2], "Contained.allof((v, i) => P00 = (7 + i*10))"); builder.WithExpression(fields[3], "Contained.anyof((v, i) => P00 = (7 + i*10))"); builder.WithExpression(fields[4], "Contained.allof((v, i, s) => P00 = (7 + i*10 + s*100))"); builder.WithExpression(fields[5], "Contained.anyof((v, i, s) => P00 = (7 + i*10 + s*100))"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(bool?))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,7", "E3,2")) .Expect(fields, false, true, false, false, false, false); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()) .Expect(fields, null, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,7", "E2,7", "E3,7")) .Expect(fields, true, true, false, true, false, false); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,0", "E2,0", "E3,0")) .Expect(fields, false, false, false, false, false, false); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()) .Expect(fields, true, false, true, false, true, false); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,1", "E2,2", "E3,327")) .Expect(fields, false, false, false, false, false, true); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,307", "E2,317", "E3,327")) .Expect(fields, false, false, false, false, true, true); builder.Run(env); }
public void Run(RegressionEnvironment env) { string[] fields = "c0,c1,c2,c3,c4,c5".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.min(x => P00)"); builder.WithExpression(fields[1], "Contained.max(x => P00)"); builder.WithExpression(fields[2], "Contained.min( (x, i) => P00 + i*10)"); builder.WithExpression(fields[3], "Contained.max( (x, i) => P00 + i*10)"); builder.WithExpression(fields[4], "Contained.min( (x, i, s) => P00 + i*10 + s*100)"); builder.WithExpression(fields[5], "Contained.max( (x, i, s) => P00 + i*10 + s*100)"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(int?))); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,12", "E2,11", "E2,2")).Expect(fields, 2, 12, 12, 22, 312, 322); builder.WithAssertion(SupportBean_ST0_Container.Make2Value("E1,12", "E2,0", "E2,2")).Expect(fields, 0, 12, 10, 22, 310, 322); builder.WithAssertion(SupportBean_ST0_Container.Make2ValueNull()).Expect(fields, null, null, null, null, null, null); builder.WithAssertion(SupportBean_ST0_Container.Make2Value()).Expect(fields, null, null, null, null, null, null); builder.Run(env); }