public MFTestResults Watchdog_1_Get_Set_GetAndCheck()
        {
            MFTestResults result = MFTestResults.Pass;

            bool             originalEnabled  = Watchdog.Enabled;
            WatchdogBehavior originalBehavior = Watchdog.Behavior;
            TimeSpan         orginalTimeout   = Watchdog.Timeout;

            try
            {
                // get the watchdog values

                bool             enabled  = Watchdog.Enabled;
                WatchdogBehavior behavior = Watchdog.Behavior;
                TimeSpan         timeout  = Watchdog.Timeout;

                Log.Comment("Enabled :" + enabled);
                Log.Comment("Behavior:" + behavior);
                Log.Comment("Timeout :" + timeout);


                // set the watchdog values
                enabled  = !enabled;
                behavior = behavior == WatchdogBehavior.SoftReboot ? WatchdogBehavior.HardReboot : WatchdogBehavior.SoftReboot;
                timeout += new TimeSpan(0, 0, 60);

                Watchdog.Enabled  = enabled;
                Watchdog.Behavior = behavior;
                Watchdog.Timeout  = timeout;

                // check the values
                if (Watchdog.Enabled != enabled)
                {
                    result = MFTestResults.Fail;
                }
                if (Watchdog.Behavior != behavior)
                {
                    result = MFTestResults.Fail;
                }
                if (Watchdog.Timeout != timeout)
                {
                    result = MFTestResults.Fail;
                }
            }
            catch (Exception ex)
            {
                result = MFTestResults.Fail;

                Log.Exception(ex.Message);
            }
            finally
            {
                Watchdog.Enabled  = originalEnabled;
                Watchdog.Behavior = originalBehavior;
                Watchdog.Timeout  = orginalTimeout;
            }

            return(result);
        }
        public MFTestResults Watchdog_2_SetTimeoutAndBehviourNoneAndCauseWatchdog()
        {
            MFTestResults result = MFTestResults.Fail;

            ///
            /// This test will not work under the debugger for network debugging
            /// devices
            ///
            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)
            {
                return(MFTestResults.Skip);
            }

            TimeSpan         originalWatchdogTimeout = Watchdog.Timeout;
            WatchdogBehavior originalBehavior        = Watchdog.Behavior;
            bool             originalWatchdogEnabled = Watchdog.Enabled;

            try
            {
                //WatchdogEvent wev = Watchdog.LastOccurrence;

                TimeSpan timeout = new TimeSpan(0, 0, 0, 2);

                // FOR A MANUAL TEST YOU CAN ENABLE THE FOLLOWING to see if a Hard or Soft reboot occurs the first time
                //Watchdog.Behavior = wev == null ? WatchdogBehavior.HardReboot : WatchdogBehavior.None;
                Watchdog.Behavior = WatchdogBehavior.None; // this will make sure the watchdog does not reboot us

                if (ValidateWatchdog(CauseWatchdog(timeout)))
                {
                    result = MFTestResults.Pass;
                }
            }
            catch (WatchdogException ex)
            {
                result = MFTestResults.Fail;

                Log.Exception(ex.Message);
            }
            catch (Exception ex)
            {
                result = MFTestResults.Fail;

                Log.Exception(ex.Message);
            }
            finally
            {
                Watchdog.Timeout  = originalWatchdogTimeout;
                Watchdog.Behavior = originalBehavior;
                Watchdog.Enabled  = originalWatchdogEnabled;
            }

            return(result);
        }
        public MFTestResults Watchdog_3_WatchdogException()
        {
            MFTestResults result = MFTestResults.Fail;

            ///
            /// This test will not work under the debugger for network debugging
            /// devices
            ///
            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)
            {
                return(MFTestResults.Skip);
            }

            TimeSpan         originalWatchdogTimeout = Watchdog.Timeout;
            WatchdogBehavior originalBehavior        = Watchdog.Behavior;
            bool             originalWatchdogEnabled = Watchdog.Enabled;

            try
            {
                TimeSpan timeout = new TimeSpan(0, 0, 0, 2);

                Watchdog.Behavior = WatchdogBehavior.DebugBreak_Managed;

                CauseWatchdog(timeout);

                Log.Comment("Error: no watchdog exception");
            }
            catch (WatchdogException)
            {
                Log.Comment("Successfully caught watchdog exception");

                if (ValidateWatchdog(null))
                {
                    result = MFTestResults.Pass;
                }
            }
            catch (Exception ex)
            {
                Log.Comment("Expected WatchdogException but got: " + ex.ToString());
                result = MFTestResults.Fail;
            }
            finally
            {
                Watchdog.Timeout  = originalWatchdogTimeout;
                Watchdog.Behavior = originalBehavior;
                Watchdog.Enabled  = originalWatchdogEnabled;
            }

            return(result);
        }