Пример #1
0
        public void RegisterCommandAndNotifyObservers()
        {
            // Create the Facade, register the FacadeTestCommand to
               			// handle 'FacadeTest' events
            IFacade facade = Facade.Instance;
            facade.RegisterCommand(4, typeof(FacadeTestCommand));

            // Send notification. The Command associated with the event
            // (FacadeTestCommand) will be invoked, and will multiply
            // the vo.input value by 2 and set the result on vo.result
            FacadeTestVO vo = new FacadeTestVO(32);
            facade.SendNotification(4, vo);

            // test assertions
            Assert.IsTrue(vo.result == 64, "Expecting vo.result == 64");
        }
Пример #2
0
        public void RegisterAndRemoveCommandAndSendNotification()
        {
            // Create the Facade, register the FacadeTestCommand to
               			// handle 'FacadeTest' events
            IFacade facade = Facade.Instance;
            facade.RegisterCommand(1, typeof(FacadeTestCommand));
            facade.RemoveCommand(1);

            // Send notification. The Command associated with the event
            // (FacadeTestCommand) will NOT be invoked, and will NOT multiply
            // the vo.input value by 2
            FacadeTestVO vo = new FacadeTestVO(32);
            facade.SendNotification(1, vo);

            // test assertions
            Assert.IsTrue(vo.result != 64, "Expecting vo.result != 64");
        }