Exemplo n.º 1
0
        public void TestLocationChanges()
        {
            var sender = _runtime.EventService.GetEventSender(typeof(MobileUserBean).Name);

            var user1 = new MobileUserBean(USER_ID_1, 10, 10,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1);

            sender.SendEvent(user1);

            var user2 = new MobileUserBean(USER_ID_2, 10, 10,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4);

            sender.SendEvent(user2);

            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());
            _runtime.EventService.SendEventBean(user1.Copy().WithLocation(8.99999, 10), EVENTTYPE);
            Assert.AreEqual(0, _listener.GetAndClearEmittedCount());

            _runtime.EventService.SendEventBean(user1.Copy().WithLocation(9, 10), EVENTTYPE);
            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());

            _runtime.EventService.SendEventBean(user1.Copy().WithLocation(11, 10), EVENTTYPE);
            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());

            _runtime.EventService.SendEventBean(user1.Copy().WithLocation(11.0000001, 10), EVENTTYPE);
            Assert.AreEqual(0, _listener.GetAndClearEmittedCount());

            _runtime.EventService.SendEventBean(user2.Copy().WithLocation(10.0000001, 9), EVENTTYPE);

            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());
        }
Exemplo n.º 2
0
        public void TestLocationChanges()
        {
            var user1 = new MobileUserBean(USER_ID_1, 10, 10,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1);

            _epService.EPRuntime.SendEvent(user1);

            var user2 = new MobileUserBean(USER_ID_2, 10, 10,
                                           Gender.FEMALE, HairColor.BLACK, AgeRange.AGE_1,
                                           Gender.MALE, HairColor.BLONDE, AgeRange.AGE_4);

            _epService.EPRuntime.SendEvent(user2);

            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());

            user1.SetLocation(8.99999, 10);
            _epService.EPRuntime.SendEvent(user1);
            Assert.AreEqual(0, _listener.GetAndClearEmittedCount());

            user1.SetLocation(9, 10);
            _epService.EPRuntime.SendEvent(user1);
            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());

            user1.SetLocation(11, 10);
            _epService.EPRuntime.SendEvent(user1);
            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());

            user1.SetLocation(11.0000001, 10);
            _epService.EPRuntime.SendEvent(user1);
            Assert.AreEqual(0, _listener.GetAndClearEmittedCount());

            user2.SetLocation(10.0000001, 9);
            _epService.EPRuntime.SendEvent(user2);
            Assert.AreEqual(1, _listener.GetAndClearEmittedCount());
        }