public void Run(RegressionEnvironment env) { string[] fields = "c0,c1".SplitCsv(); SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(fields[0], "Contained.selectFrom( (v, i) => new {v0=v.Id,v1=i})"); builder.WithExpression(fields[1], "Contained.selectFrom( (v, i, s) => new {v0=v.Id,v1=i + 100*s})"); builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make3Value("E1,12,0", "E2,11,0", "E3,2,0")) .Verify( fields[0], value => AssertRows( value, new object[][] { new object[] { "E1", 0 }, new object[] { "E2", 1 }, new object[] { "E3", 2 } })) .Verify( fields[1], value => AssertRows( value, new object[][] { new object[] { "E1", 300 }, new object[] { "E2", 301 }, new object[] { "E3", 302 } })); builder.WithAssertion(SupportBean_ST0_Container.Make3Value("E4,0,1")) .Verify( fields[0], value => AssertRows( value, new object[][] { new object[] { "E4", 0 } })) .Verify( fields[1], value => AssertRows( value, new object[][] { new object[] { "E4", 100 } })); builder.WithAssertion(SupportBean_ST0_Container.Make3ValueNull()) .Verify(fields[0], value => AssertRows(value, null)) .Verify(fields[1], value => AssertRows(value, null)); builder.WithAssertion(SupportBean_ST0_Container.Make3Value()) .Verify(fields[0], value => AssertRows(value, new object[0][])) .Verify(fields[1], value => AssertRows(value, new object[0][])); builder.Run(env); }
public void Run(RegressionEnvironment env) { string field = "c0"; SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container"); builder.WithExpression(field, "Contained.selectFrom(x => new {c0 = Id||'x', c1 = Key0||'y'})"); builder.WithStatementConsumer(stmt => AssertTypes(stmt.EventType, field, typeof(ICollection <object>))); builder.WithAssertion(SupportBean_ST0_Container.Make3Value("E1,12,0", "E2,11,0", "E3,2,0")) .Verify( field, value => AssertRows( value, new object[][] { new object[] { "E1x", "12y" }, new object[] { "E2x", "11y" }, new object[] { "E3x", "2y" } })); builder.WithAssertion(SupportBean_ST0_Container.Make3Value("E4,0,1")) .Verify( field, value => AssertRows( value, new object[][] { new object[] { "E4x", "0y" } })); builder.WithAssertion(SupportBean_ST0_Container.Make3ValueNull()) .Verify(field, value => AssertRows(value, null)); builder.WithAssertion(SupportBean_ST0_Container.Make3Value()) .Verify(field, value => AssertRows(value, new object[0][])); builder.Run(env); }