/*-------------------------------------------------------------------------
//                           UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.

THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.

UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NLog;
using System;
using System.Threading;

namespace UnitTests
{
   [TestClass]
   public class ProgramUnitTest
   {
      private ILogger _logger;

      public ProgramUnitTest()
      {
         _logger = LogManager.GetCurrentClassLogger();
      }

      [TestMethod]
      public void PowerSupplyTest()
      {
         try
         {
            ProgramLib.Program.Instance("partNumber", "SerialNumber", false);
            ProgramLib.Program.Instance().InitializeDioMeasurementManager();
            ProgramLib.Program.Instance().InitializePowerSupplyMeasurementManager();
            ProgramLib.Program.Instance().InitializeGuiManager();
            ProgramLib.Program.Instance().InitializeSupportThreads();

            int runs = 2;
            int i = 0;
            while (i++ < runs)
            {
               ProgramLib.Program.Instance().UutPowerOn();
               Thread.Sleep(10000);
               ProgramLib.Program.Instance().UutPowerOff();
               Thread.Sleep(5000);
               ProgramLib.Program.Instance().UutPowerOn();
               Thread.Sleep(10000);
               ProgramLib.Program.Instance().UutPowerOff();
               Thread.Sleep(5000);
            }
         }
         catch (Exception ex)
         {
            _logger.Error(ex.Message + "\r\n" + ex.StackTrace);
         }
      }

      [TestMethod]
      public void SttoTest()
      {
         try
         {
            ProgramLib.Program.Instance("partNumber", "SerialNumber", false);
            ProgramLib.Program.Instance().InitializeSwitchMeasurementManager();
            ProgramLib.Program.Instance().InitializeGuiManager();

            ProgramLib.Program.Instance().Perform_GMA_ATP_001_UUT_STTO();
         }
         catch (Exception ex)
         {
            _logger.Error(ex.Message + "\r\n" + ex.StackTrace);
         }
      }
   }
}
