private XVector3 GetPoint(Directions dir) => unity.GetClosestPoint(_Centre, dir);
public void BoxIdentifierBoundsTrapezoids() { float[] centre = { 0, 100, 0 }; float[] v0 = RotateY(60, new float[] { 20, 100, 60 }); float[] v1 = RotateY(60, new float[] { 20, 100, -20 }); float[] v2 = RotateY(60, new float[] { -20, 100, -20 }); float[] v3 = RotateY(60, new float[] { -20, 100, 30 }); float[] h = { 0, 300, 0 }; float[] l = { 0, 0, 0 }; unity.GetCentre().Returns(centre); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.Up).Returns(h); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.Down).Returns(l); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.North).Returns(v3); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.South).Returns(v1); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.East).Returns(v0); unity.GetClosestPoint(Arg.Any <float[]>(), Directions.West).Returns(v2); var id = new BoxIdentifier(unity); unity.Received(1).GetCentre(); unity.Received(6).GetClosestPoint(Arg.Any <float[]>(), Arg.Any <Directions>()); v1[1] = 0; v2[1] = 0; Assert.True(id.Start == v1 || id.Start == v2); Assert.True(Math.Abs(id.Length - 80) < 1 && Math.Abs(id.Width - 40) < 1 || Math.Abs(id.Length - 40) < 1 && Math.Abs(id.Width - 80) < 1); }