protected override void EstablishContext()
        {
            controlDevice = A.Fake <ISpiControlDevice>();
            A.CallTo(() => controlDevice.Control(A <uint> .Ignored, A <SpiTransferControlStructure[]> .Ignored))
            .Returns(IOCTL_PINVOKE_RESULT_CODE);

            connection = new NativeSpiConnection(controlDevice);

            // SPI control structure we expect to see during the P/Invoke call
            controlStructure = new SpiTransferControlStructure
            {
                BitsPerWord      = BITS_PER_WORD,
                Length           = 5,
                Delay            = DELAY,
                ChipSelectChange = 1,
                Speed            = SPEED_IN_HZ
            };

            buffer = A.Fake <ISpiTransferBuffer>();
            A.CallTo(() => buffer.ControlStructure)
            .Returns(controlStructure);

            // setup fake collection to return our "prepared" fake buffer
            collection = A.Fake <ISpiTransferBufferCollection>();
            A.CallTo(() => collection.Length)
            .Returns(1);
            A.CallTo(() => collection.GetEnumerator())
            .ReturnsLazily(call => new List <ISpiTransferBuffer> {
                buffer
            }.GetEnumerator());
        }