Esempio n. 1
0
		private void ReportMachine (Machine machine, StringBuilder result)
		{
			result.Append ("Machine " + machine.Name ());
			if (machine.Bin () != null)
				result.Append (" bin=" + machine.Bin().Contents());
			result.Append ("\n");
		}
        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()));
        }