public void DeInitializeBluetoothCentral_Test()
        {
            Mock_BluetoothHardwareInterface bhi      = new Mock_BluetoothHardwareInterface();
            Mock_WristbandServices          services = new Mock_WristbandServices();
            WristbandProtocol protocol = new WristbandProtocol(bhi, services);
            TestObserever     observer = new TestObserever();

            // Bluetooth hardware interface behaviour
            // ---------------------------
            bhi.DeInitialize_Mock = (Action action) => { action(); };
            bhi.Initialize_Mock   = Initialize_BHI_Success;

            // track observer event states
            // ---------------------------
            bool initFired   = false;
            bool deinitFired = false;
            bool errorFired  = false;

            observer.TestInitResponse = () => {
                output.WriteLine("> TestObserever.OnBluetoothInitialized() :: called");
                initFired = true;
            };

            observer.TestDeInitResponse = () => {
                output.WriteLine("> TestObserever.OnBluetoothDeInitialized() :: called");
                deinitFired = true;
            };

            observer.TestOnErrorResponse = (WristbandProtocolError error, string msg) => {
                output.WriteLine("> TestObserever.OnError() :: Error - " + msg);
                errorFired = true;
            };

            // run protocol
            // ---------------------------
            protocol.SubscibeObserver(observer);
            protocol.InitialyzeCentral();

            Assert.True(initFired && !deinitFired, "Observer Initialize should fire before Deinitialize");
            Assert.True(protocol.IsInitialized(), "protocol should be in initialized state before we deinitialize");

            protocol.DeInitialyzeCentral();

            // test results
            // ---------------------------
            Assert.True(deinitFired, "Observer should fire OnBluetoothDeInitialized");
            Assert.False(errorFired, "Observer should not fire OnError");

            // protocol state tests
            Assert.False(protocol.IsInitialized(), "protocol should not be in initialized state");
            Assert.False(protocol.HasProfile(), "protocol should not have a profile");
            Assert.False(protocol.HasDiscoveredDevice(), "protocol should not be have disovered divices");
            Assert.False(protocol.IsConnected(), "protocol should not be connected");
            Assert.False(protocol.HasHistory(), "protocol should not have a history");
            Assert.False(protocol.IsBusy(), "protocol should not be busy");
        }
        public void ScanForDeviceAndAutoConnect_Test()
        {
            Mock_BluetoothHardwareInterface bhi      = new Mock_BluetoothHardwareInterface();
            Mock_WristbandServices          services = new Mock_WristbandServices();
            WristbandProtocol protocol = new WristbandProtocol(bhi, services);
            TestObserever     observer = new TestObserever();

            // Bluetooth hardware interface behaviour
            // ---------------------------
            BluetoothHardwareInterface_ScanDevices(bhi, services);
            bhi.Initialize_Mock = Initialize_BHI_Success;

            // track observer event states
            // ---------------------------
            bool connectFired      = false;
            bool errorFired        = false;
            bool profileFoundFired = false;
            bool unknownProfile    = false;

            observer.TestInitResponse = () => {
                output.WriteLine("> TestObserever.OnBluetoothInitialized() :: called");
            };
            observer.TestConnectedResponse = (string pheriperalID, string pheriperalName, WristbandProfile profile) => {
                output.WriteLine("> TestObserever.OnWristbandConnected() :: called -name:" + pheriperalName + ", -id:" + pheriperalID);
                connectFired = true;
            };
            observer.TestOnErrorResponse = (WristbandProtocolError error, string msg) => {
                output.WriteLine("> TestObserever.OnError() :: Error - " + msg);
                errorFired = true;
            };
            observer.TestProfileFoundResponse = (string id, string name) => {
                output.WriteLine("> TestObserever.OnWristbandProfileFound() :: called -name:" + name + ", -id:" + id);
                profileFoundFired = true;
            };
            observer.TestUnknownProfileResponse = (string id, string name) => {
                output.WriteLine("> TestObserever.OnWristbandUnknownProfile() :: called -name:" + name + ", -id:" + id);
                unknownProfile = true;
            };

            // run protocol
            // ---------------------------
            protocol.SubscibeObserver(observer);
            protocol.InitialyzeCentral();

            Assert.True(!errorFired && !connectFired, "Observer Initialize should fire before scanning for devices");
            Assert.True(protocol.IsInitialized(), "protocol should be in initialized state before scanning for devices");
            Assert.False(protocol.HasProfile(), "protocol should not have a profile before scanning for devices");
            Assert.False(protocol.HasDiscoveredDevice(), "protocol should not be have disovered divices before scanning for devices");
            Assert.False(protocol.IsConnected(), "protocol should not be connected before scanning for devices");

            protocol.ScanForDeviceAndAutoConnect();

            // test results
            // ---------------------------
            Assert.True(connectFired, "Observer should fire OnWristbandConnected");
            Assert.False(errorFired, "Observer should not fire OnError");
            Assert.True(profileFoundFired, "Observer should fire OnWristbandProfileFound");
            Assert.False(unknownProfile, "Observer should not fire OnWristbandUnknownProfile");

            // protocol state tests
            Assert.True(protocol.IsInitialized(), "protocol should be in initialized state");
            Assert.True(protocol.HasProfile(), "protocol should have a profile");
            Assert.True(protocol.HasDiscoveredDevice(), "protocol should have disovered divices");
            Assert.True(protocol.IsConnected(), "protocol should be connected");
            Assert.False(protocol.HasHistory(), "protocol should not have a history");
            Assert.False(protocol.IsBusy(), "protocol should not be busy");
        }