Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestCaseDirectoryDataUtils"/> class.
 /// </summary>
 /// <param name="testCaseId">
 /// The test case id.
 /// </param>
 /// <param name="testCaseDirectoryRoot">
 /// The test case directory root.
 /// </param>
 public TestCaseDirectoryDataUtils(int testCaseId, string testCaseDirectoryRoot)
 {
     TestCaseDirectoryRoot      = testCaseDirectoryRoot;
     TestCaseId                 = testCaseId;
     TestCaseFileAndFolderUtils = new TestCaseFileAndFolderUtils(TestCaseId, TestCaseDirectoryRoot);
     TestDataValuesFilePath     = TestCaseFileAndFolderUtils.GetTestCaseRootFilePath("TestDataValues.txt");
     ConstantsFilePath          = TestCaseFileAndFolderUtils.GetTestCaseRootFilePath("Constants.txt");
     KeyValuePairUtils          = new KeyValuePairUtils();
     StringTransformationUtils  = new StringTransformationUtils();
     Init();
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestCaseDirectoryDataUtils"/> class.
 /// </summary>
 /// <param name="testCaseFileAndFolderUtils">
 /// The test Case File And Folder Utils.
 /// </param>
 /// <param name="stringTransformationUtils">
 /// The string Transformation Utils.
 /// </param>
 public TestCaseDirectoryDataUtils(TestCaseFileAndFolderUtils testCaseFileAndFolderUtils, IStringTransformationUtils stringTransformationUtils)
 {
     TestCaseDirectoryRoot      = testCaseFileAndFolderUtils.TestCaseDirectory;
     TestCaseId                 = testCaseFileAndFolderUtils.TestCaseId;
     TestCaseFileAndFolderUtils = testCaseFileAndFolderUtils;
     TestDataValuesFilePath     = TestCaseFileAndFolderUtils.GetTestCaseRootFilePath("TestDataValues.txt");
     ConstantsFilePath          = TestCaseFileAndFolderUtils.GetTestCaseRootFilePath("Constants.txt");
     KeyValuePairUtils          = new KeyValuePairUtils();
     StringTransformationUtils  = stringTransformationUtils;
     StringTransformationUtils.RegisterAllStuFunctionsForType(this);
     Init();
 }
        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");
        }
        public void TestSimpleTestDataManagement2()
        {
            var testCaseFileAndFolderUtils = new TestCaseFileAndFolderUtils(4002, @".\TestData\EndToEnd");
            var testDataValuesFilePath     = testCaseFileAndFolderUtils.GetTestCaseRootFilePath("TestDataValues.txt");
            var keyValuePairUtils          = new KeyValuePairUtils();
            var testData = keyValuePairUtils.ReadKeyValuePairsFromFile(testDataValuesFilePath);

            foreach (var testDataKey in testData.Keys)
            {
                var value = testData[testDataKey];

                StfLogger.LogInfo($"[{testDataKey}] has the value [{value}]");
            }
        }