Example #1
0
        public void RaisesEventsToAllSubscribersSyncSpecialized()
        {
            // arrange
            Event4 += EventHandlerExtensionsTestsEvent1;
            Event4 += AlwaysThrowException;

            var args = new MyEventArgs {
                ThrowExceptionAfterHitCount = 1
            };
            var errors = new List <Exception>();

            // ReSharper disable once ConvertToLocalFunction
            Action <Exception> handler = exception => { errors.Add(exception); };

            // act
            Event4.RaiseSafe(this, args, handler); //1 pass 1 fail
            Event4.RaiseSafe(this, args, handler); //2 fail
            Event4.RaiseSafe(this, args, handler); //2 fail

            Assert.Equal(5, errors.Count);
            Assert.Equal(1, args.HitCount);

            args.HitCount = 0;

            // act
            Event4.RaiseSafe(this, args, handler); //pass

            Assert.Equal(1, args.HitCount);
        }
    void signal(char c)
    {
        switch (c)
        {
        case '0':
            break;

        case '1':
            Debug.Log("got called?");
            Event1.Invoke();
            break;

        case '2':
            Event2.Invoke();
            break;

        case '3':
            Event3.Invoke();
            break;

        case '4':
            Event4.Invoke();
            break;

        case '5':
            Event5.Invoke();
            break;

        case '6':
            Event6.Invoke();
            break;

        case '7':
            Event7.Invoke();
            break;

        case '8':
            Event8.Invoke();
            break;

        case '9':
            Event9.Invoke();
            break;

        case 'a':
            EventA.Invoke();
            break;

        case 'b':
            EventB.Invoke();
            break;

        case 'c':
            EventC.Invoke();
            break;

        case 'd':
            EventD.Invoke();
            break;

        case 'e':
            EventE.Invoke();
            break;

        case 'f':
            EventF.Invoke();
            break;

        case 'g':
            EventG.Invoke();
            break;

        case 'h':
            EventH.Invoke();
            break;

        case 'i':
            EventI.Invoke();
            break;

        case 'j':
            EventJ.Invoke();
            break;

        case 'k':
            EventK.Invoke();
            break;
        }
    }
Example #3
0
 public virtual void SetUp()
 {
     Event = ScriptableObject.CreateInstance <Event4>();
 }
Example #4
0
 public bool Handle(Event4 x)
 {
     return true;
 }