예제 #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");
        }
예제 #3
0
        /// <summary>
        /// The compile test data values.
        /// </summary>
        /// <returns>
        /// The <see cref="OrderedDictionary"/>.
        /// </returns>
        private OrderedDictionary CompileTestDataValues()
        {
            //// Compilation Step
            //// -Temp\TestDataValues.txt(all TestDataValue files compiled into one file)
            ////    - include files resolved(marked for debug with comments)
            ////
            var originalDict = KeyValuePairUtils.ReadKeyValuePairsFromFile(TestDataValuesFilePath);

            // TODO: Do some compilation here as per comment above (gathering all TDV's together)
            var retVal = originalDict;

            var compiledTestDataValuesFilePath =
                TestCaseFileAndFolderUtils.GetTestCaseTempFilePath("TestDataValues.compiled.txt", false);

            KeyValuePairUtils.SaveKeyValuePairsToFile(compiledTestDataValuesFilePath, retVal, "Compiled Test Data Values");

            return(retVal);
        }
예제 #4
0
        /// <summary>
        /// The resolve test data values.
        /// </summary>
        /// <returns>
        /// The <see cref="OrderedDictionary"/>.
        /// </returns>
        private OrderedDictionary ResolveTestDataValues()
        {
            //// Resolution Step
            //// -Temp\TestDataValues.resolved.txt
            ////    - values overlayed
            ////
            var compiledTestDataValuesFilePath =
                TestCaseFileAndFolderUtils.GetTestCaseTempFilePath("TestDataValues.compiled.txt", false);
            var compiledDict = KeyValuePairUtils.ReadKeyValuePairsFromFile(compiledTestDataValuesFilePath);

            // TODO: Do some resolving and overlaying as per comment above on Resolving step
            var retVal = compiledDict;

            var resolvedTestDataValuesFilePath =
                TestCaseFileAndFolderUtils.GetTestCaseTempFilePath("TestDataValues.resolved.txt", false);

            KeyValuePairUtils.SaveKeyValuePairsToFile(
                resolvedTestDataValuesFilePath,
                retVal,
                "Resolved Test Data Values");
            return(retVal);
        }