private void RunAssertionWindowStats(EPServiceProvider epService) { // Get the top 3 volumes for each symbol EPStatement top3Prices = epService.EPAdministrator.CreateEPL( "select * from " + typeof(SupportMarketDataBean).FullName + "#unique(symbol)#sort(3, price desc)"); var testListener = new SupportUpdateListener(); top3Prices.Events += testListener.Update; var beans = new object[10]; beans[0] = MakeEvent(SYMBOL_CSCO, 50); epService.EPRuntime.SendEvent(beans[0]); object[] result = top3Prices .Select(x => x.Underlying) .ToArray(); EPAssertionUtil.AssertEqualsExactOrder(new[] { beans[0] }, result); Assert.IsTrue(testListener.IsInvoked); EPAssertionUtil.AssertEqualsExactOrder((object[])null, testListener.LastOldData); EPAssertionUtil.AssertEqualsExactOrder(new[] { beans[0] }, new[] { testListener.LastNewData[0].Underlying }); testListener.Reset(); beans[1] = MakeEvent(SYMBOL_CSCO, 20); beans[2] = MakeEvent(SYMBOL_IBM, 50); beans[3] = MakeEvent(SYMBOL_MSFT, 40); beans[4] = MakeEvent(SYMBOL_C, 100); beans[5] = MakeEvent(SYMBOL_IBM, 10); epService.EPRuntime.SendEvent(beans[1]); epService.EPRuntime.SendEvent(beans[2]); epService.EPRuntime.SendEvent(beans[3]); epService.EPRuntime.SendEvent(beans[4]); epService.EPRuntime.SendEvent(beans[5]); result = top3Prices .Select(x => x.Underlying) .ToArray(); EPAssertionUtil.AssertEqualsExactOrder(new[] { beans[4], beans[3], beans[5] }, result); beans[6] = MakeEvent(SYMBOL_CSCO, 110); beans[7] = MakeEvent(SYMBOL_C, 30); beans[8] = MakeEvent(SYMBOL_CSCO, 30); epService.EPRuntime.SendEvent(beans[6]); epService.EPRuntime.SendEvent(beans[7]); epService.EPRuntime.SendEvent(beans[8]); result = top3Prices .Select(x => x.Underlying) .ToArray(); EPAssertionUtil.AssertEqualsExactOrder(new[] { beans[3], beans[8], beans[7] }, result); top3Prices.Dispose(); }