/// <summary>
        /// Saves to a named file the string at awg.CalibrationDataFactory or awg.CalibrationDataUser
        /// depending on the specified calibration data type.
        /// </summary>
        /// <param name="awg"></param>
        /// <param name="dataType"></param>
        /// <param name="fileName"></param>
        public void SaveTheCalibrationData(IAWG awg, CalibrationDataType dataType, string fileName)
        {
            string calConstants         = (dataType == CalibrationDataType.Factory ? awg.CalibrationDataFactory : awg.CalibrationDataUser);
            string possibleErrorMessage = (dataType == CalibrationDataType.Factory ? "Factory Data Constants empty" : "User Data Constants empty");

            Assert.IsTrue((calConstants != ""), possibleErrorMessage);

            string dir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);

            dir += "\\Tektronix\\AWG\\AWG70k";
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            dir += "\\TestFramework";
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            dir += (dataType == CalibrationDataType.Factory ? "\\Factory" : "\\User");
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            dir += "\\" + fileName + ".xml";

            FileInfo xmlFile = new FileInfo(dir);

            using (StreamWriter xmlResults = xmlFile.CreateText())
            {
                xmlResults.WriteLine(calConstants);
            }
        }
        /// <summary>
        /// This tests the property for state of the factory calibration<para>
        /// Do a get first to update the property</para>
        /// </summary>
        /// <param name="awg"></param>
        /// <param name="dataType"></param>
        public void StateoftheCalibrationforAWGShouldHaveAVaildFormat(IAWG awg, CalibrationDataType dataType)
        {
            string state;
            string possibleErrorMessage;

            if (dataType == CalibrationDataType.Factory)
            {
                state = awg.CalStateFactory;
                possibleErrorMessage = "Invalid Factory State in the Calibration for the AWG. Actual value: ";
            }
            else
            {
                state = awg.CalStateUser;
                possibleErrorMessage = "Invalid User State in the Calibration for the AWG. Actual value: ";
            }

            if (state == "")
            {
                Assert.Fail("AWG not Calibrated No Results to Validate");
            }
            var   validatePreMatcher = new Regex(@".+:=S\((?<calState>C|U).+");
            Match preMatch           = validatePreMatcher.Match(state); // If the AWG is uncalibrated it will only return a "U"

            Assert.IsTrue(preMatch.Success);                            // Need to handle that first and then handle date and temp
            string calState = preMatch.Groups["calState"].Value;

            switch (calState)
            {
            case "C":
                var validateMatcher = new Regex(@".*:=S\(C\),D\(.*\),T\(.*\)");
                var match           = validateMatcher.Match(state);
                Assert.IsTrue(match.Success);
                break;

            case "U":
                Assert.AreEqual("U", calState);
                break;

            default:
                Assert.Fail(possibleErrorMessage + state);
                break;
            }
        }
        public void CalibrationDataFromAWGShouldBeValid(IAWG awg, CalibrationDataType calDataType)
        {
            string result = "";

            switch (calDataType)
            {
            case CalibrationDataType.Factory:
                if (string.IsNullOrEmpty(awg.CalibrationDataFactory) || awg.CalibrationDataFactory.StartsWith("-340"))
                {
                    Assert.Fail("Calibration factory data is invalid.");
                }
                result = _utils.ValidateXML(awg.CalibrationDataFactory);
                break;

            case CalibrationDataType.User:
                if (string.IsNullOrEmpty(awg.CalibrationDataUser) || awg.CalibrationDataUser.StartsWith("-340"))
                {
                    Assert.Fail("Calibration user data is invalid.");
                }
                result = _utils.ValidateXML(awg.CalibrationDataUser);
                break;
            }
            Assert.AreEqual("", result, "XML was not valid because " + result);
        }