コード例 #1
0
		public void SetUp()
		{
			_mockIoCommunicator = new Mock<IOCommunicator>();

			var startStreamBytes = new byte[] { 148, 1, Sensor.Bumps_And_WheelDrops };
			_writeToIoExpectation = ioCommunicator => ioCommunicator.Write(
														It.Is<byte[]>(bytes => BytesAreEqual(startStreamBytes, bytes)), 
														It.Is<int>(offset => offset == 0),
														It.Is<int>(length => length == startStreamBytes.Length)
													);
			_mockIoCommunicator.Setup(_writeToIoExpectation);

			var sensors = new List<ISensor>
			              	{
			              		new BumpsAndWheelDrops()
			              	};
			_robotController = new RobotController(_mockIoCommunicator.Object, sensors);
			_robotController.StartSensorStream();
		}
コード例 #2
0
		public void SetUp()
		{
			_mockIoCommunicator = new Mock<IOCommunicator>();


			_bumpsAndWheelDropsSensor = new BumpsAndWheelDrops();
			var sensors = new List<ISensor>
			              	{
			              		_bumpsAndWheelDropsSensor
			              	};
			_robotController = new RobotController(_mockIoCommunicator.Object, sensors);
			_robotController.StartSensorStream();

			byte dataByte = new BitArray(new[] {true, true, false, false, false, false, false, false}).ToByte();
			var sensorUpdateBytes = new[]
			                        	{
											Sensor.Bumps_And_WheelDrops,
											dataByte
			                        	};
			_mockIoCommunicator.Raise(ioCommunicator => ioCommunicator.DataRecieved += null, sensorUpdateBytes);
		}