Beispiel #1
0
        public void RaisesEventsToAllSubscribersSync()
        {
            // arrange
            Event3 += EventHandlerExtensionsTestsEvent1;
            Event3 += AlwaysThrowException;

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

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

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

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

            args.HitCount = 0;

            Event3.RaiseSafe(this, args, handler); //pass

            Assert.Equal(1, args.HitCount);
        }
Beispiel #2
0
 public static void Registe(string key, Event3 e)
 {
     if (m_Event3.ContainsKey(key))
     {
         m_Event3[key] += e;
     }
     else
     {
         m_Event3.Add(key, e);
     }
 }
                public void CanExecuteUsingObjectObjectOverload()
                {
                    var passed = false;

                    _model1EventProcessor.Event1Details.NormalStage.RegisterAction((m, e) =>
                    {
                        object event3 = new Event3();
                        _router.ExecuteEvent(_model1.Id, event3);
                        passed = _model1EventProcessor.Event3Details.NormalStage.ReceivedEvents.Count == 1;
                    });
                    _router.PublishEvent(_model1.Id, new Event1());
                    passed.ShouldBe(true);
                }
Beispiel #4
0
 public void RaiseEvent3()
 {
     Event3?.Invoke("555");
 }
    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;
        }
    }
Beispiel #6
0
 public virtual void SetUp()
 {
     Event = ScriptableObject.CreateInstance <Event3>();
 }
Beispiel #7
0
 private void Handle(Event3 evnt)
 {
 }
Beispiel #8
0
 public void RaiseE()
 {
     Event3.Raise(this, EventArgs.Empty);
 }
Beispiel #9
0
 public void RaiseD()
 {
     Event3.Raise(this);
 }
Beispiel #10
0
 public bool Handle(Event3 x)
 {
     return true;
 }