Beispiel #1
0
        public void Read_GoodPin(TestDevice testDevice)
        {
            Pcx857x device = testDevice.Device;

            for (int pin = 0; pin < testDevice.Device.PinCount; pin++)
            {
                // Set pin to input
                device.SetPinMode(pin, PinMode.Input);

                bool first    = pin < 8;
                int  register = first ? 0x00 : 0x01;

                // Flip the bit on (set the backing buffer directly to simulate incoming data)
                testDevice.ChipMock.Registers[register] = (byte)(1 << (first ? pin : pin - 8));
                Assert.Equal(PinValue.High, device.Read(pin));

                // Clear the register
                testDevice.ChipMock.Registers[register] = 0x00;
                Assert.Equal(PinValue.Low, device.Read(pin));
            }
        }