예제 #1
0
        public static void Main(string[] args)
        {
            var fbObservable     = new NotificationProvider("Facebook");
            var githubObservable = new NotificationProvider("GitHub");

            var observer = new NotificationSubscriber("Florin");

            observer.Subscribe(fbObservable);
            //observer.Unsubscribe();

            observer.Subscribe(githubObservable);
            //observer.Unsubscribe();

            var observer2 = new NotificationSubscriber("Piagio");

            observer2.Subscribe(fbObservable);

            fbObservable.EventNotification("Event notification 1 !");
            githubObservable.EventNotification("Event notification!");
        }
예제 #2
0
 public void CheckSubscribe()
 {
     Assert.AreEqual(0, publisher.Observers.Count);
     subscriber.Subscribe(publisher, EventType.RequestPurchaseEvent);
     Assert.AreEqual(1, publisher.Observers.Count);
 }