コード例 #1
0
        private Dice GetDiceMock()
        {
            var realDice = new YoloDice();
            var diceMock = A.Fake <Dice>();

            A.CallTo(() => diceMock.RollK100()).Returns(realDice.RollK100());
            A.CallTo(() => diceMock.RollBetween(A <int> .Ignored, A <int> .Ignored))
            .ReturnsLazily((int low, int high) => realDice.RollBetween(low, high));
            A.CallTo(() => diceMock.RollChance(A <int> .Ignored)).ReturnsLazily((int chance) => realDice.RollChance(chance));
            A.CallTo(() => diceMock.RollPosition(A <int> .Ignored, A <int> .Ignored))
            .ReturnsLazily((int width, int height) => realDice.RollPosition(width, height));

            return(diceMock);
        }
コード例 #2
0
ファイル: Monster.cs プロジェクト: sheldarr/yolo-crawler
 public Monster(string name, Position position)
 {
     Name      = name;
     Position  = position;
     Hitpoints = new YoloDice().RollForHitpoints(MinHitpoints, MaxHitpoints);
 }
コード例 #3
0
 public Map()
 {
     _yoloDice = new YoloDice();
     Rooms     = new List <Room>();
 }