Ejemplo n.º 1
0
 public void BestellingOntvangen(object sender, BestelEventArgs args)
 {
     if (args == null || string.IsNullOrEmpty(args.Product))
     {
         return;                                                     // preconditie
     }
     System.Console.WriteLine(args.Product + " in voorbereiding");
     System.Threading.Thread.Sleep(5000);
     Bel.Ring(args);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Klant klant1 = new Klant("Piet");
            Klant klant2 = new Klant("Jef");
            BestellingsSysteem bestellingsSysteem = new BestellingsSysteem();
            Bel  bel  = new Bel();
            Ober ober = new Ober("Jan")
            {
                BestellingsSysteem = bestellingsSysteem,
                Bel = bel
            };
            Kok kok = new Kok("Marie")
            {
                BestellingsSysteem = bestellingsSysteem,
                Bel = bel
            };

            klant1.Bestel(ober, "Hoegaarden");
            klant2.Bestel(ober, "Koffie");
        }
Ejemplo n.º 3
0
        public void Bestel_BijCorrecteBestelling_ZouRingEventMoetenOpgeroepenZijn()
        {
            BestellingsSysteem bestellingsSysteem = new BestellingsSysteem();
            Bel   bel    = new Bel();
            Klant klant1 = new Klant("Piet");

            Ober ober = new Ober("Jan")
            {
                BestellingsSysteem = bestellingsSysteem,
                Bel = bel,
            };
            Kok kok = new Kok("Marie")
            {
                BestellingsSysteem = bestellingsSysteem,
                Bel = bel,
            };

            using (var monitoredSubject = bel.Monitor())
            {
                klant1.Bestel(ober, "Hoegaarden");
                monitoredSubject.Should().Raise("RingEvent");
            }
        }