예제 #1
0
        public void TestLessPlaceholdersInOutput()
        {
            string projectPath = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));
            Dictionary <string, string> resultMap = new Dictionary <string, string>();
            BuildArtifactsMapping       mapping   = new BuildArtifactsMapping();

            mapping.input  = @"regex_test\(.+)\(.+).dll";
            mapping.output = @"a/$2.dll";

            BuildArtifactsMappingResolver.matchMappingArtifacts(mapping, projectPath, resultMap);
            Dictionary <string, string> resultMapExpected = new Dictionary <string, string>();

            CollectionAssert.Contains(resultMap, new KeyValuePair <string, string>(projectPath + @"\regex_test\obj\Debug\JFrog.Artifactory.dll",
                                                                                   @"a/JFrog.Artifactory.dll"));
        }
예제 #2
0
        public void TestComplexRegex()
        {
            string projectPath = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));
            Dictionary <string, string> resultMap = new Dictionary <string, string>();
            BuildArtifactsMapping       mapping   = new BuildArtifactsMapping();

            //Enforce only file with digits
            mapping.input  = @"regex_test\(.+)\(.+[\d].+)";
            mapping.output = @"a/$2";

            BuildArtifactsMappingResolver.matchMappingArtifacts(mapping, projectPath, resultMap);
            Dictionary <string, string> resultMapExpected = new Dictionary <string, string>();

            CollectionAssert.Contains(resultMap, new KeyValuePair <string, string>(
                                          projectPath + @"\regex_test\lib\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs",
                                          @"a/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs"
                                          ));
        }
예제 #3
0
        public void TestMatchMapping()
        {
            BuildArtifactsMapping mapping = new BuildArtifactsMapping();

            mapping.input  = @"regex_test\(.+)\(.+).dll";
            mapping.output = @"msbuild-test\$1\$2.dll";

            Dictionary <string, string> resultMap = new Dictionary <string, string>();
            string projectPath = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));

            BuildArtifactsMappingResolver.matchMappingArtifacts(mapping, projectPath, resultMap);

            Dictionary <string, string> resultMapExpected = new Dictionary <string, string>();

            resultMapExpected.Add(projectPath + @"\regex_test\lib\JFrog.Artifactory.dll",
                                  @"msbuild-test\lib\JFrog.Artifactory.dll");
            resultMapExpected.Add(projectPath + @"\regex_test\obj\Debug\JFrog.Artifactory.dll",
                                  @"msbuild-test\obj\Debug\JFrog.Artifactory.dll");
            resultMapExpected.Add(projectPath + @"\regex_test\obj\Release\JFrog.Artifactory.dll",
                                  @"msbuild-test\obj\Release\JFrog.Artifactory.dll");

            CollectionAssert.AreEqual(resultMap, resultMapExpected);


            mapping.input  = @"regex_test\(.+)\(.+).dll";
            mapping.output = @"msbuild-test\$2\$1.dll";

            resultMap.Clear();
            resultMapExpected.Clear();
            BuildArtifactsMappingResolver.matchMappingArtifacts(mapping, projectPath, resultMap);
            resultMapExpected.Add(projectPath + @"\regex_test\lib\JFrog.Artifactory.dll",
                                  @"msbuild-test\JFrog.Artifactory\lib.dll");
            resultMapExpected.Add(projectPath + @"\regex_test\obj\Debug\JFrog.Artifactory.dll",
                                  @"msbuild-test\JFrog.Artifactory\obj\Debug.dll");
            resultMapExpected.Add(projectPath + @"\regex_test\obj\Release\JFrog.Artifactory.dll",
                                  @"msbuild-test\JFrog.Artifactory\obj\Release.dll");

            //none exists folder need to check
            CollectionAssert.AreEqual(resultMap, resultMapExpected);
        }