Exemple #1
0
        /// <summary>
        /// The transform test data values.
        /// </summary>
        /// <returns>
        /// The <see cref="OrderedDictionary"/>.
        /// </returns>
        private OrderedDictionary TransformTestDataValues()
        {
            //// Transformation Step
            //// - Results\TestDataValues.transformed.txt(ready to load using KeyValuePairUtils)
            ////    -values evaluated
            ////    - Constants applied(Results\Constants.transformed.txt)
            ////- Simple functions called
            var resolvedTestDataValuesFilePath =
                TestCaseFileAndFolderUtils.GetTestCaseTempFilePath("TestDataValues.resolved.txt", false);
            var resolvedDict = KeyValuePairUtils.ReadKeyValuePairsFromFile(resolvedTestDataValuesFilePath);

            var transformedDict = new OrderedDictionary();

            // TODO: Is this the kind of transformation we require see above
            foreach (var key in resolvedDict.Keys)
            {
                var value = (string)resolvedDict[key];

                var evaluatedValue = StringTransformationUtils.Evaluate(value);

                transformedDict.Add(key, evaluatedValue);
            }

            var transformedTestDataValuesFilePath =
                TestCaseFileAndFolderUtils.GetTestCaseResultsFilePath("TestDataValues.transformed.txt", false);

            KeyValuePairUtils.SaveKeyValuePairsToFile(
                transformedTestDataValuesFilePath,
                transformedDict,
                "Transformed Test Data Values");
            return(transformedDict);
        }
        public void TestTestCaseDirectoriesExists()
        {
            var testCaseFileAndFolderUtils = new TestCaseFileAndFolderUtils(9001, UnitTestTestDataRoot);

            // root
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath(null), @"Tc9001");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath(string.Empty), @"Tc9001");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath("FileName.NotExists"), null);
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath("FileName.NotExists", false), @"Tc9001\FileName.NotExists");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath("UnitTestRootFile01.txt"), @"Tc9001\UnitTestRootFile01.txt");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseRootFilePath("UnitTestRootFile01.txt", false), @"Tc9001\UnitTestRootFile01.txt");

            // Results
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath(null), @"Tc9001\Results");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath(string.Empty), @"Tc9001\Results");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath("FileName.NotExists"), null);
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath("FileName.NotExists", false), @"Tc9001\Results\FileName.NotExists");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath("UnitTestResultFile01.txt"), @"Tc9001\Results\UnitTestResultFile01.txt");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseResultsFilePath("UnitTestResultFile01.txt", false), @"Tc9001\Results\UnitTestResultFile01.txt");

            // Temp
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath(null), @"Tc9001\Temp");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath(string.Empty), @"Tc9001\Temp");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath("FileName.NotExists"), null);
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath("FileName.NotExists", false), @"Tc9001\Temp\FileName.NotExists");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath("UnitTestTempFile01.txt"), @"Tc9001\Temp\UnitTestTempFile01.txt");
            HelperTestCaseDirectories(testCaseFileAndFolderUtils.GetTestCaseTempFilePath("UnitTestTempFile01.txt", false), @"Tc9001\Temp\UnitTestTempFile01.txt");
        }
Exemple #3
0
        /// <summary>
        /// The get constants values.
        /// </summary>
        /// <returns>
        /// The <see cref="OrderedDictionary"/>.
        /// </returns>
        private OrderedDictionary GetConstantsValues()
        {
            ////(2) Evaluate Constants.txt
            ////    - Temp\Constants.list.txt(all constant files compiled into one file)
            ////    - include files resolved(marked for debug with comments)
            ////    -Temp\Constants.resolved.txt
            ////    - values overlayed
            ////    - Results\Constants.transformed.txt(ready to load using KeyValuePairUtils)

            var retVal = KeyValuePairUtils.ReadKeyValuePairsFromFile(ConstantsFilePath);
            var resolvedConstantFilePath = TestCaseFileAndFolderUtils.GetTestCaseResultsFilePath("Constants.Resolved.txt", false);

            KeyValuePairUtils.SaveKeyValuePairsToFile(resolvedConstantFilePath, retVal, "Resolved Constants");
            return(retVal);
        }