public void ダッシュ開始時に速度がSpeedの値になること() { float expected = dash.Speed; dash.GetType().InvokeMember("DoDash", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, dash, new object[] { EightDirection.Right }); Assert.AreEqual(expected, agent.RigidbodyCache.velocity.x); }
public void SetUp() { agent = Substitute.For <IAgent>(); actionObj = new GameObject("dash", typeof(Dash)); rigidbody = new GameObject("rigidbody", typeof(Rigidbody2D)).GetComponent <Rigidbody2D>(); dash = actionObj.GetComponent <Dash>(); agent.RigidbodyCache.Returns(rigidbody); dash.Speed = 100; dash.MinimumSpeed = 10; dash.ConstantSpeedFrames = 5; dash.DashFrameLimit = 10; PropertyInfo AgentProperty = dash.GetType().BaseType.GetProperty("Agent", BindingFlags.Instance | BindingFlags.NonPublic); AgentProperty.SetValue(dash, agent, null); }