public void TestForwardsMax() { MovementSpeeds speeds = new MovementSpeeds(5, 5, 5) { ForwardSpeed = 10 }; Assert.AreEqual(speeds.Max, 10); }
public void TestSidewaysMax() { MovementSpeeds speeds = new MovementSpeeds(5, 5, 5) { SidewaysSpeed = 10 }; Assert.AreEqual(speeds.Max, 10); }
public void TestHashCode() { MovementSpeeds a = new MovementSpeeds(5, 10, 3); MovementSpeeds b = new MovementSpeeds(5, 10, 3); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); b.ForwardSpeed = 0; Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void TestEqualsOperator() { MovementSpeeds a = new MovementSpeeds(5, 10, 3); MovementSpeeds b = new MovementSpeeds(5, 10, 3); Assert.IsTrue(a == b); Assert.IsFalse(a != b); b.ForwardSpeed = 0; Assert.IsFalse(a == b); }
public void TestEquals() { MovementSpeeds a = new MovementSpeeds(5, 10, 3); MovementSpeeds b = new MovementSpeeds(5, 10, 3); Assert.IsTrue(a.Equals(b)); Assert.IsFalse(a.Equals(new object())); b.ForwardSpeed = 0; Assert.IsFalse(a.Equals(b)); }
private InMemoryCollidableBodies( MovementSpeeds movementSpeeds, Bodies bodies, Collisions collisions) { UnityEngine.Debug.Assert(movementSpeeds != null); this.movementSpeeds = movementSpeeds; UnityEngine.Debug.Assert(bodies != null); this.bodies = bodies; UnityEngine.Debug.Assert(collisions != null); this.collisions = collisions; }
public void Does_not_support_a_null_collection_of_movement_speeds() { MovementSpeeds movementSpeeds = null; var bodies = new DummyBodies(); var collisions = new DummyCollisions(); Assert.Throws <ArgumentNullException>(() => { InMemoryCollidableBodies.WithCollections( movementSpeeds, bodies, collisions); }); }
/// <summary> /// Create a <see cref="InMemoryCollidableBodies"/> with a given /// <see cref="MovementSpeeds"/>, <see cref="Bodies"/>, and /// <see cref="Collisions"/>. /// </summary> /// <param name="movementSpeeds"> /// The <see cref="MovementSpeeds"/>. /// </param> /// <param name="bodies"> /// The <see cref="Bodies"/>. /// </param> /// <param name="collisions"> /// The <see cref="Collisions"/>. /// </param> /// <returns> /// A <see cref="InMemoryCollidableBodies"/> created with the given /// <see cref="MovementSpeeds"/>, <see cref="Bodies"/>, and /// <see cref="Collisions"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// Thrown when the given <see cref="MovementSpeeds"/> is null. /// /// -or- /// /// Thrown when the given <see cref="Bodies"/> is null. /// /// -or- /// /// Thrown when the given <see cref="Collisions"/> is null. /// </exception> internal static InMemoryCollidableBodies WithCollections( MovementSpeeds movementSpeeds, Bodies bodies, Collisions collisions) { if (movementSpeeds == null) { throw new ArgumentNullException(nameof(movementSpeeds)); } if (bodies == null) { throw new ArgumentNullException(nameof(bodies)); } if (collisions == null) { throw new ArgumentNullException(nameof(collisions)); } return(new InMemoryCollidableBodies( movementSpeeds, bodies, collisions)); }
public void ChangeSpeed(MovementSpeeds new_speed) { movement_speed = new_speed; speed = Constants.SPEEDS[(int)movement_speed]; }