Beispiel #1
0
        void RobotService_Place_ValidPlacement_Allowed(int x, int y, Facing f, int tableWidth, int tableHeight, 
            [Frozen]Mock<IRobot> mockRobot, [Frozen]Mock<ITable> mockTable, RobotService sut)
        {
            mockTable.SetupTableFixture(tableWidth, tableHeight);

            sut.Place(x, y, f);

            mockTable.VerifyGet(t => t.Width, Times.AtLeastOnce());
            mockTable.VerifyGet(t => t.Height, Times.AtLeastOnce());

            mockRobot.VerifySet(r => r.X = x, Times.Once());
            mockRobot.VerifySet(r => r.Y = y, Times.Once());
            mockRobot.VerifySet(r => r.F = f, Times.Once());
            mockRobot.VerifySet(r => r.Placed = true, Times.Once());
        }
Beispiel #2
0
        void RobotService_Place_InvalidPlacement_Ignored(int x, int y, Facing f, int tableWidth, int tableHeight, [Frozen] Mock<IRobot> mockRobot,
            [Frozen] Mock<ITable> mockTable, RobotService sut)
        {
            mockTable.SetupTableFixture(tableWidth, tableHeight);

            sut.Place(x, y, f);

            mockTable.VerifyGet(t => t.Width, Times.AtLeastOnce());
            mockTable.VerifyGet(t => t.Height, Times.AtLeastOnce());

            mockRobot.VerifySet(r => r.X = It.IsAny<int>(), Times.Never());
            mockRobot.VerifySet(r => r.Y = It.IsAny<int>(), Times.Never());
            mockRobot.VerifySet(r => r.F = It.IsAny<Facing>(), Times.Never());
            mockRobot.VerifySet(r => r.Placed = It.IsAny<bool>(), Times.Never());
        }