Slide 17
Slide 17 text
テストコー
ド
public class PlayerUnitTest {
//
テスト用のいい感じモック
public class MockPlayerUnit : IPlayerUnit {
public float Speed { get; set; }
public Vector3 Position { get; set; }
}
[Test]
public void PlayerUnitMove() {
var unit = new MockPlayerUnit { Speed = 5, Position = Vector3.zero };
var controller = new PlayerUnitController(unit);
controller.Move(Vector3.up);
Assert.AreEqual(new Vector3(0,5F,0), unit.Position);
}
}
Roppongi.unity #1 2019/02/21