public void can_enable_disable_specific_bit()
        {
            // Arrange
            var deviceState = 0;
            var i2c         = Substitute.For <II2c>();

            i2c.When(x => x.WriteToDevice(Arg.Any <int>(), Arg.Any <byte>()))
            .Do(x => deviceState = x.Arg <byte>());

            var powerOutput = new InvertedPcfOutput(i2c);

            // Act
            powerOutput.SetState(BuildOutputDescriptor(1, "O1"), true);  // 1111 1110
            powerOutput.SetState(BuildOutputDescriptor(1, "O3"), true);  // 1111 1010
            powerOutput.SetState(BuildOutputDescriptor(1, "O6"), true);  // 1101 1010
            powerOutput.SetState(BuildOutputDescriptor(1, "O3"), false); // 1101 1110 => 222

            // Assert
            Assert.Equal(222, deviceState);
        }
        public void can_set_and_read_state()
        {
            // Arrange
            var deviceState = 0;
            var i2c         = Substitute.For <II2c>();

            i2c.When(x => x.WriteToDevice(Arg.Any <int>(), Arg.Any <byte>()))
            .Do(x => deviceState = x.Arg <byte>());

            var powerOutput = new InvertedPcfOutput(i2c);

            // Act
            powerOutput.SetState(BuildOutputDescriptor(1, "O3"), true);  // 0000 0100

            // Assert
            Assert.Equal(false, powerOutput.GetState(BuildOutputDescriptor(1, "O1")));
            Assert.Equal(false, powerOutput.GetState(BuildOutputDescriptor(1, "O2")));
            Assert.Equal(true, powerOutput.GetState(BuildOutputDescriptor(1, "O3")));
            Assert.Equal(false, powerOutput.GetState(BuildOutputDescriptor(1, "O4")));
        }