public void Extract() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); SurfaceData surfaceData = new SurfaceData(); subject.Source = surfaceData; Assert.IsFalse(extractedMock.Received); Assert.AreEqual(null, subject.Result); Assert.IsFalse(subject.Result.HasValue); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(); hitData.point = Vector3.one; surfaceData.CollisionData = hitData; subject.Extract(); Assert.IsTrue(extractedMock.Received); Assert.IsNotNull(subject.Result.Value.transform); Assert.AreEqual(Vector3.one, subject.Result.Value.point); Object.DestroyImmediate(containingObject); }
public IEnumerator ExtractNoCollisionData() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); yield return(null); GameObject blocker = RaycastHitHelper.CreateBlocker(); blocker.SetActive(false); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(blocker); subject.Source = hitData; Assert.IsFalse(extractedMock.Received); Assert.IsNull(subject.Result); subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.IsNull(subject.Result); Object.DestroyImmediate(containingObject); }
public void ExtractNoCollisionData() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); SurfaceData surfaceData = new SurfaceData(); GameObject blocker = RaycastHitHelper.CreateBlocker(); blocker.SetActive(false); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(blocker); surfaceData.CollisionData = hitData; subject.Source = surfaceData; Assert.IsFalse(extractedMock.Received); Assert.AreEqual(null, subject.Result); Assert.IsFalse(subject.Result.HasValue); subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.AreEqual(null, subject.Result); Assert.IsFalse(subject.Result.HasValue); }
public void ExtractInactiveComponent() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); SurfaceData surfaceData = new SurfaceData(); subject.Source = surfaceData; subject.enabled = false; Assert.IsFalse(extractedMock.Received); Assert.AreEqual(null, subject.Result); Assert.IsFalse(subject.Result.HasValue); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(); hitData.point = Vector3.one; surfaceData.CollisionData = hitData; subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.AreEqual(null, subject.Result); Assert.IsFalse(subject.Result.HasValue); }
public void ExtractInactiveGameObject() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(); subject.Source = hitData; subject.gameObject.SetActive(false); Assert.IsFalse(extractedMock.Received); Assert.IsFalse(subject.Result.HasValue); subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.IsFalse(subject.Result.HasValue); }
public void Extract() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(); subject.Source = hitData; Assert.IsFalse(extractedMock.Received); Assert.IsFalse(subject.Result.HasValue); subject.Extract(); Assert.IsTrue(extractedMock.Received); Assert.AreEqual(Vector3.zero, subject.Result); Object.DestroyImmediate(containingObject); }
public void ExtractInactiveComponent() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(); subject.Source = hitData; subject.enabled = false; hitData.normal = Vector3.one; Assert.IsFalse(extractedMock.Received); Assert.IsFalse(subject.Result.HasValue); subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.IsFalse(subject.Result.HasValue); }
public void Extract() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); GameObject blocker = RaycastHitHelper.CreateBlocker(); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(blocker); subject.Source = hitData; Assert.IsFalse(extractedMock.Received); Assert.IsNull(subject.Result); subject.Extract(); Assert.IsTrue(extractedMock.Received); Assert.AreEqual(blocker, subject.Result); Object.DestroyImmediate(containingObject); }
public void ExtractInactiveGameObject() { UnityEventListenerMock extractedMock = new UnityEventListenerMock(); subject.Extracted.AddListener(extractedMock.Listen); GameObject blocker = RaycastHitHelper.CreateBlocker(); Rigidbody target = blocker.AddComponent <Rigidbody>(); RaycastHit hitData = RaycastHitHelper.GetRaycastHit(blocker); subject.Source = hitData; subject.gameObject.SetActive(false); Assert.IsFalse(extractedMock.Received); Assert.IsNull(subject.Result); subject.Extract(); Assert.IsFalse(extractedMock.Received); Assert.IsNull(subject.Result); Object.DestroyImmediate(containingObject); }