コード例 #1
0
        public void NotInTableCannotMove()
        {
            GetValidMockContextAndSettingWhichOnTable(out var mockContext, out var mockSettings);
            mockContext.Object.Position.X = mockSettings.Object.MinX - 1;  //Make IsOnTable return false
            var service = new ToyRobotService(mockContext.Object, mockSettings.Object);
            var actual  = service.CanMove();

            Assert.IsFalse(actual);
        }
コード例 #2
0
        public void CanMoveWhenFacingWestButNotAtWestEdge()
        {
            GetValidMockContextAndSettingWhichOnTable(out var mockContext, out var mockSettings);
            mockContext.Object.Position.X = mockSettings.Object.MinX + 1;
            mockContext.Setup(mc => mc.Facing).Returns(Facing.West);
            var service = new ToyRobotService(mockContext.Object, mockSettings.Object);
            var actual  = service.CanMove();

            Assert.IsTrue(actual);
        }
コード例 #3
0
        public void CannotMoveWhenFacingEastAtEastEdge()
        {
            GetValidMockContextAndSettingWhichOnTable(out var mockContext, out var mockSettings);
            mockContext.Object.Position.X = mockSettings.Object.MaxX;
            mockContext.Setup(mc => mc.Facing).Returns(Facing.East);
            var service = new ToyRobotService(mockContext.Object, mockSettings.Object);
            var actual  = service.CanMove();

            Assert.IsFalse(actual);
        }