public void StubSensorReturnsNothingWhenDisconnected()
        {
            // Arrange
            var stubSensor = new StubUltrasonicSensor(StubBrick, NxtBrick.Sensor.First);
            StubBrick.ConnectionFckedUp = true;
            stubSensor.InitSensor();

            // Act 
            // start sensing
            stubSensor.StartGettingValues();
            Thread.Sleep(1000);
            var values = stubSensor.StopGettingValues();

            // Assert
            Assert.AreEqual(0, values.Count);
        }
Exemple #2
0
        public void StubSensorReturnsNothingWhenDisconnected()
        {
            // Arrange
            var stubSensor = new StubUltrasonicSensor(StubBrick, NxtBrick.Sensor.First);

            StubBrick.ConnectionFckedUp = true;
            stubSensor.InitSensor();

            // Act
            // start sensing
            stubSensor.StartGettingValues();
            Thread.Sleep(1000);
            var values = stubSensor.StopGettingValues();

            // Assert
            Assert.AreEqual(0, values.Count);
        }
        public void StubSensorReturnsValuesBetween0And255()
        {
            // Arrange
            var stubSensor = new StubUltrasonicSensor(StubBrick, NxtBrick.Sensor.First);
            stubSensor.InitSensor();

            // Act 
            // start sensing
            stubSensor.StartGettingValues();
            Thread.Sleep(1000);
            var values = stubSensor.StopGettingValues();

            // Assert
            Assert.AreNotEqual(0, values.Count);
            Assert.IsTrue(values.All((value) => value >= stubSensor.MinSensorValue && value <= stubSensor.MaxSensorValue));

        }
Exemple #4
0
        public void StubSensorReturnsValuesBetween0And255()
        {
            // Arrange
            var stubSensor = new StubUltrasonicSensor(StubBrick, NxtBrick.Sensor.First);

            stubSensor.InitSensor();

            // Act
            // start sensing
            stubSensor.StartGettingValues();
            Thread.Sleep(1000);
            var values = stubSensor.StopGettingValues();

            // Assert
            Assert.AreNotEqual(0, values.Count);
            Assert.IsTrue(values.All((value) => value >= stubSensor.MinSensorValue && value <= stubSensor.MaxSensorValue));
        }