示例#1
0
            public void Run(RegressionEnvironment env)
            {
                string epl = "@public @buseventtype @JsonSchema(ClassName='" +
                             typeof(SupportUsersEvent).FullName +
                             "') create json schema Users();\n" +
                             "@Name('s0') select * from Users;";

                env.CompileDeploy(epl).AddListener("s0");

                // try sender parse-only
                EventSenderJson   sender = (EventSenderJson)env.Runtime.EventService.GetEventSender("Users");
                SupportUsersEvent users  = (SupportUsersEvent)sender.Parse(UsersJson);

                AssertUsersPremade(users);

                // try send-event
                sender.SendEvent(UsersJson);
                EventBean @event = env.Listener("s0").AssertOneGetNewAndReset();

                AssertUsersPremade((SupportUsersEvent)@event.Underlying);

                // try write
                JSONEventRenderer render = env.Runtime.RenderEventService.GetJSONRenderer(@event.EventType);

                Assert.AreEqual(UsersJsonReplaceWhitespace, render.Render(@event));

                env.UndeployAll();
            }
示例#2
0
 private void AssertUsersPremade(SupportUsersEvent users)
 {
     Assert.AreEqual(2, users.users.Count);
     SupportUsersEvent.User first = users.users[0];
     Assert.AreEqual("45166552176594981065", first._id);
     SupportUsersEvent.User second = users.users[1];
     Assert.AreEqual("23504426278646846580", second._id);
     EPAssertionUtil.AssertEqualsExactOrder(UserObject.users.ToArray(), users.users.ToArray());
 }