예제 #1
0
        public void TestSetLogicWithContained()
        {
            String epl = "select " + "contained.except(containedTwo) as val0,"
                         + "contained.intersect(containedTwo) as val1, "
                         + "contained.union(containedTwo) as val2 "
                         + " from SupportBean_ST0_Container";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(epl);

            stmt.Events += _listener.Update;
            LambdaAssertionUtil.AssertTypes(stmt.EventType, "val0".Split(','),
                                            new Type[] { typeof(ICollection <SupportBean_ST0>) }
                                            );

            List <SupportBean_ST0> first = SupportBean_ST0_Container.Make2ValueList(
                "E1,1", "E2,10", "E3,1", "E4,10", "E5,11");
            List <SupportBean_ST0> second = SupportBean_ST0_Container.Make2ValueList(
                "E1,1", "E3,1", "E4,10");

            _epService.EPRuntime.SendEvent(
                new SupportBean_ST0_Container(first, second));
            LambdaAssertionUtil.AssertST0Id(_listener, "val0", "E2,E5");
            LambdaAssertionUtil.AssertST0Id(_listener, "val1", "E1,E3,E4");
            LambdaAssertionUtil.AssertST0Id(_listener, "val2",
                                            "E1,E2,E3,E4,E5,E1,E3,E4");
            _listener.Reset();
        }
            public void Run(RegressionEnvironment env)
            {
                string[]           fields  = "c0,c1,c2".SplitCsv();
                SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container");

                builder.WithExpression(fields[0], "Contained.except(ContainedTwo)");
                builder.WithExpression(fields[1], "Contained.intersect(ContainedTwo)");
                builder.WithExpression(fields[2], "Contained.union(ContainedTwo)");

                builder.WithStatementConsumer(stmt => AssertTypesAllSame(stmt.EventType, fields, typeof(ICollection <object>)));

                IList <SupportBean_ST0> first  = SupportBean_ST0_Container.Make2ValueList("E1,1", "E2,10", "E3,1", "E4,10", "E5,11");
                IList <SupportBean_ST0> second = SupportBean_ST0_Container.Make2ValueList("E1,1", "E3,1", "E4,10");

                builder.WithAssertion(new SupportBean_ST0_Container(first, second))
                .Verify("c0", val => AssertST0Id(val, "E2,E5"))
                .Verify("c1", val => AssertST0Id(val, "E1,E3,E4"))
                .Verify("c2", val => AssertST0Id(val, "E1,E2,E3,E4,E5,E1,E3,E4"));

                builder.Run(env);
            }