public void CreateReport_GetReport_ShouldBeNotNullAndNotEmpty() { OfficeCleaningReporter reporter = new OfficeCleaningReporter(); string report = reporter.GetReport(); Assert.IsNotNull(report); Assert.IsFalse(string.IsNullOrEmpty(report)); }
public void CreateRobot_AddReporting_CleanOffice_CleanedPlacesEqualThree() { var reporter = new OfficeCleaningReporter(); Robot robot = new Robot(_cleaningCommand, reporter); robot.CleanOffice(); var cleanedPlaces = reporter.GetCleanedWorkingPlacesCount(); Assert.AreEqual(4, cleanedPlaces); }
public void CreateRobot_SendOutOfTheBounds_RobotIsNotMovingOutOfTheBounds() { CommandManager manager = new CommandManager(); manager.AddInputParameters("1"); manager.AddInputParameters("-99999 0"); manager.AddInputParameters("W 2"); var reporter = new OfficeCleaningReporter(); var robot = new Robot(manager.CleanOfficeCommand, reporter); robot.CleanOffice(); var placesCount = reporter.GetCleanedWorkingPlacesCount(); Assert.AreEqual(2, placesCount); }
public void CreateReport_AddUniquePositions_CleanedPlacesCountIsEqualToPositionsCount() { OfficeCleaningReporter reporter = new OfficeCleaningReporter(); reporter.LogRobotPosition(new Position { X = 0, Y = 0 }); reporter.LogRobotPosition(new Position { X = 1, Y = 0 }); reporter.LogRobotPosition(new Position { X = 1, Y = 1 }); var uniquePlaces = reporter.GetCleanedWorkingPlacesCount(); Assert.AreEqual(3, uniquePlaces); }
public void CreateRobotWithCommandManager_CleanOffice_CleanedPlacesCountIsCorrect() { CommandManager manager = new CommandManager(); manager.AddInputParameters("4"); manager.AddInputParameters("0 0"); manager.AddInputParameters("N 5"); manager.AddInputParameters("E 5"); manager.AddInputParameters("S 5"); manager.AddInputParameters("W 5"); var reporter = new OfficeCleaningReporter(); var robot = new Robot(manager.CleanOfficeCommand, reporter); robot.CleanOffice(); var placesCount = reporter.GetCleanedWorkingPlacesCount(); Assert.AreEqual(20, placesCount); }
public void CreateRobot_AddMaxCountOfCommands_CleanedPlacesCountIsCorrect() { CommandManager manager = new CommandManager(); manager.AddInputParameters("10000"); manager.AddInputParameters("-100000 0"); for (int i = 0; i < 10000; i++) { manager.AddInputParameters("E 10"); } var reporter = new OfficeCleaningReporter(); var robot = new Robot(manager.CleanOfficeCommand, reporter); robot.CleanOffice(); var placesCount = reporter.GetCleanedWorkingPlacesCount(); Assert.AreEqual(100001, placesCount); }
static void Main(string[] args) { var commandManager = new CommandManager(); Console.WriteLine("Input Robot parameters:"); while (!commandManager.IsCommandsSetComplete) { Console.Write("=> "); commandManager.AddInputParameters(Console.ReadLine()); } var reporter = new OfficeCleaningReporter(); var robot = new Robot(commandManager.CleanOfficeCommand, reporter); robot.CleanOffice(); Console.WriteLine(robot.GetCleaningReport()); Console.ReadLine(); }