示例#1
0
        void Application_Report_Allowed(string command, [Frozen]Mock<IRobotService> mockRobotService, 
            [Frozen]Mock<IOutputWriter> mockOutputWriter, Application sut)
        {
            sut.ProcessCommand(command);

            mockRobotService.Verify(r => r.Report(), Times.Once());
            mockOutputWriter.Verify(w => w.WriteLine(It.IsAny<string>()), Times.Once());
        }
示例#2
0
 void Application_Place_ValidPlacementParams_Allowed(string command, int xInput, int yInput, Facing fInput, 
     [Frozen] Mock<IRobotService> mockRobotService, Application sut)
 {
     sut.ProcessCommand(command);
     mockRobotService.Verify(rs => rs.Place(It.Is<int>(x => x == xInput),
                                              It.Is<int>(y => y == yInput),
                                              It.Is<Facing>(f => f == fInput)), Times.Once());
 }
示例#3
0
        void Application_ProcessCommand_Empty_Ignored([Frozen] Mock<IRobotService> mockRobotService, Application sut)
        {
            sut.ProcessCommand(string.Empty);

            mockRobotService.Verify(r => r.Left(), Times.Never());
            mockRobotService.Verify(r => r.Right(), Times.Never());
            mockRobotService.Verify(r => r.Move(), Times.Never());
            mockRobotService.Verify(r => r.Place(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<Facing>()), Times.Never());
            mockRobotService.Verify(r => r.Report(), Times.Never());
        }
示例#4
0
 void Application_Right_Allowed(string command, [Frozen] Mock<IRobotService> mockRobotService, Application sut)
 {
     sut.ProcessCommand(command);
     mockRobotService.Verify(x => x.Right(), Times.Once());
 }
示例#5
0
 void Application_Place_InvalidPlacementParams_Ignored(string command, [Frozen] Mock<IRobotService> mockRobotService, 
     Application sut)
 {
     sut.ProcessCommand(command);
     mockRobotService.Verify(rs => rs.Place(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<Facing>()), Times.Never());
 }