Exemplo n.º 1
0
        public void TestReport()
        {
			var p = new ProductionLine();
			p.AddMachine("mixer", "left");

            Machine extruder = p.AddMachine("extruder", "center");
            extruder.Put(new Bin("paste"));

            Machine oven = p.AddMachine("oven", "right");
            oven.Put(new Bin("chips"));

            Robot robot = new Robot();
            robot.MoveTo(extruder);
            robot.Pick();

            var output = new Report(p, robot).report();

            string expected = "FACTORY REPORT\n"
                              + "Machine mixer\n"
							  + "Machine extruder\n"
                              + "Machine oven bin=chips\n\n"
                              + "Robot location=extruder bin=paste\n" + "========\n";

            Assert.That(expected, Is.EqualTo(output));
        }
Exemplo n.º 2
0
        public void TestRobot()
        {
            Machine sorter = new Machine("Sorter", "left");
            sorter.Put(new Bin("chips"));
            Machine oven = new Machine("Oven", "middle");
            Robot robot = new Robot();

            Assert.That("chips", Is.EqualTo(sorter.Bin().Contents()));
            Assert.That(oven.Bin(), Is.Null);
            Assert.That(robot.Location(), Is.Null);
            Assert.That(robot.Bin(), Is.Null);

            robot.MoveTo(sorter);
            robot.Pick();
            robot.MoveTo(oven);
            robot.Release();

            Assert.That(robot.Bin(), Is.Null);
            Assert.That(oven, Is.EqualTo(robot.Location()));
            Assert.That(sorter.Bin(), Is.Null);
            Assert.That("chips", Is.EqualTo(oven.Bin().Contents()));
        }
Exemplo n.º 3
0
		internal Report(ProductionLine line, Robot robot)
		{
			_line = line;
			_robot = robot;
		}