Exemplo n.º 1
0
        public void OnCollisionStop_CanCancelTrigger_CancelTriggerMessageSent()
        {
            var expectedGameObject = new GameObject();

            _trigger.CanCancelTriggerResult = true;

            var messageSpy = new UnityTestMessageHandleResponseObject <CancelTriggerMessage>();

            var handle = UnityMessageEventFunctions.RegisterActionWithDispatcher <CancelTriggerMessage>
                             (_trigger.gameObject, messageSpy.OnResponse);

            _trigger.TestStopColliding(expectedGameObject);

            Assert.IsTrue(messageSpy.ActionCalled);

            Assert.AreSame(expectedGameObject, messageSpy.MessagePayload.TriggeringObject);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_trigger.gameObject, handle);
        }