예제 #1
0
        public void ExtractFromPublisher()
        {
            UnityEventListenerMock extractedMock = new UnityEventListenerMock();

            subject.Extracted.AddListener(extractedMock.Listen);

            GameObject publisherSource = new GameObject();
            GameObject publisherChild  = new GameObject();

            publisherChild.transform.SetParent(publisherSource.transform);
            ActiveCollisionPublisher.PayloadData publisher = new ActiveCollisionPublisher.PayloadData();

            publisher.SourceContainer = publisherSource;

            Assert.IsNull(subject.Result);
            Assert.IsFalse(extractedMock.Received);

            subject.Extract(publisher);

            Assert.AreEqual(publisherSource, subject.Result);
            Assert.IsTrue(extractedMock.Received);

            Object.DestroyImmediate(publisherSource);
            Object.DestroyImmediate(publisherChild);
        }
        public void ExtractFromPublisher()
        {
            UnityEventListenerMock extractedMock = new UnityEventListenerMock();

            subject.Extracted.AddListener(extractedMock.Listen);

            GameObject publisherSource = new GameObject();
            GameObject publisherChild  = new GameObject();

            publisherChild.transform.SetParent(publisherSource.transform);
            ActiveCollisionPublisher publisher = publisherChild.AddComponent <ActiveCollisionPublisher>();

            publisher.sourceContainer = publisherSource;

            Assert.IsNull(subject.SourceContainer);
            Assert.IsFalse(extractedMock.Received);

            subject.Extract(publisher);

            Assert.AreEqual(publisherSource, subject.SourceContainer);
            Assert.IsTrue(extractedMock.Received);
        }