OnPop() public method

public OnPop ( string soda, Spring.Util.EventRaiser raiser ) : IEventExceptionsCollector
soda string
raiser Spring.Util.EventRaiser
return IEventExceptionsCollector
Exemplo n.º 1
0
 public void RaiseWithAnEventHandlerThatThrowsAnException () 
 {
     OneThirstyDude dude = new OneThirstyDude ();
     Soda bru = new Soda ();
     bru.Pop += new PopHandler (dude.HandlePopWithException);
     bru.OnPop ("Iron Brew", new EventRaiser ());
 }
 public void RaiseSwallowsExceptionRaisedByHandlers()
 {
     OneThirstyDude dude = new OneThirstyDude();
     Soda bru = new Soda();
     bru.Pop += new PopHandler(dude.HandlePopWithException);
     bru.OnPop("Iron Brew", new DefensiveEventRaiser());
     Assert.AreEqual("Iron Brew", dude.Soda); // should have got through before exception was thrown
 }
        public void RaiseWithAnEventHandlerThatThrowsAnException()
        {
            OneThirstyDude dude = new OneThirstyDude();
            Soda           bru  = new Soda();

            bru.Pop += new PopHandler(dude.HandlePopWithException);
            Assert.Throws <FormatException>(() => bru.OnPop("Iron Brew", new EventRaiser()), "Iron Brew");
        }
Exemplo n.º 4
0
 public void Raise () 
 {
     OneThirstyDude dude = new OneThirstyDude ();
     Soda bru = new Soda ();
     bru.Pop += new PopHandler (dude.HandlePop);
     bru.OnPop ("Iron Brew", new EventRaiser ());
     Assert.AreEqual ("Iron Brew", dude.Soda);
 }
        public void Raise()
        {
            OneThirstyDude dude = new OneThirstyDude();
            Soda           bru  = new Soda();

            bru.Pop += new PopHandler(dude.HandlePop);
            bru.OnPop("Iron Brew", new EventRaiser());
            Assert.AreEqual("Iron Brew", dude.Soda);
        }
Exemplo n.º 6
0
        public void RaiseSwallowsExceptionRaisedByHandlers()
        {
            OneThirstyDude dude = new OneThirstyDude();
            Soda           bru  = new Soda();

            bru.Pop += new PopHandler(dude.HandlePopWithException);
            bru.OnPop("Iron Brew", new DefensiveEventRaiser());
            Assert.AreEqual("Iron Brew", dude.Soda); // should have got through before exception was thrown
        }
        public void RaiseSwallowsExceptionRaisedByHandlerButCallsAllOtherHandlers()
        {
            bool firstCall = false;
            bool secondCall = false;
            bool thirdCall = false;

            OneThirstyDude dude = new OneThirstyDude();
            Soda bru = new Soda();
            bru.Pop += (sender, soda) => firstCall = true;
			bru.Pop += (sender, soda) => { secondCall = true; throw new Exception(); };
			bru.Pop += (sender, soda) => { thirdCall = true; };

            DefensiveEventRaiser eventRaiser = new DefensiveEventRaiser();

            IEventExceptionsCollector exceptions = bru.OnPop( "Iron Brew", eventRaiser );

            Assert.AreEqual(1, exceptions.Exceptions.Count);
            Assert.IsTrue(firstCall);
            Assert.IsTrue(secondCall);
            Assert.IsTrue(thirdCall);
        }
Exemplo n.º 8
0
        public void RaiseSwallowsExceptionRaisedByHandlerButCallsAllOtherHandlers()
        {
            bool firstCall  = false;
            bool secondCall = false;
            bool thirdCall  = false;

            OneThirstyDude dude = new OneThirstyDude();
            Soda           bru  = new Soda();

            bru.Pop += (sender, soda) => firstCall = true;
            bru.Pop += (sender, soda) => { secondCall = true; throw new Exception(); };
            bru.Pop += (sender, soda) => { thirdCall = true; };

            DefensiveEventRaiser eventRaiser = new DefensiveEventRaiser();

            IEventExceptionsCollector exceptions = bru.OnPop("Iron Brew", eventRaiser);

            Assert.AreEqual(1, exceptions.Exceptions.Count);
            Assert.IsTrue(firstCall);
            Assert.IsTrue(secondCall);
            Assert.IsTrue(thirdCall);
        }