예제 #1
0
            public void Should_handle_single_rule_with_source_only()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse("source=>");

                ArtifactRule artifactRule = pathRules[0];

                Assert.Equal("source", artifactRule.Source);
                Assert.Equal(string.Empty, artifactRule.Dest);
            }
예제 #2
0
            public void Should_handle_single_rule_with_whitespace_padding()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse("  source  => dest  ");

                ArtifactRule artifactRule = pathRules[0];

                Assert.Equal("source", artifactRule.Source);
                Assert.Equal("dest", artifactRule.Dest);
            }
예제 #3
0
            public void Should_handle_single_rule_with_new_line()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse("source=>dest" + Environment.NewLine);

                Assert.Equal(1, pathRules.Count);

                ArtifactRule artifactRule = pathRules[0];

                Assert.Equal("source", artifactRule.Source);
                Assert.Equal("dest", artifactRule.Dest);
            }
예제 #4
0
            public void Should_handle_multiple_rules_with_left_side_only()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse("source=>dest" + Environment.NewLine + "source2=>");

                Assert.Equal(2, pathRules.Count);


                Assert.Equal("source", pathRules[0].Source);
                Assert.Equal("dest", pathRules[0].Dest);

                Assert.Equal("source2", pathRules[1].Source);
                Assert.Equal(string.Empty, pathRules[1].Dest);
            }
예제 #5
0
            public void Should_handle_multiple_rules()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse("source=>dest" + Environment.NewLine + "source2=>dest2");

                Assert.Equal(2, pathRules.Count);


                Assert.Equal("source", pathRules[0].Source);
                Assert.Equal("dest", pathRules[0].Dest);

                Assert.Equal("source2", pathRules[1].Source);
                Assert.Equal("dest2", pathRules[1].Dest);
            }
예제 #6
0
        private static List <ArtifactRule> GetArtifactRules(DependencyDefinition dependency)
        {
            Property artifactRulesProperty =
                dependency.Properties.Property.FirstOrDefault(
                    x => x.Name.Equals("pathRules", StringComparison.InvariantCultureIgnoreCase));

            if (artifactRulesProperty == null || string.IsNullOrWhiteSpace(artifactRulesProperty.Value))
            {
                throw new Exception(string.Format("Missing or invalid Artifact dependency. ProjectId: {0}", dependency.SourceBuildConfig.ProjectId));
            }

            List <ArtifactRule> artifactRules = ArtifactRule.Parse(artifactRulesProperty.Value);

            return(artifactRules);
        }
예제 #7
0
            public void Should_handle_empty_with_line_breaks()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse(Environment.NewLine);

                Assert.Empty(pathRules);
            }
예제 #8
0
            public void Should_handle_empty_strings()
            {
                List <ArtifactRule> pathRules = ArtifactRule.Parse(string.Empty);

                Assert.Empty(pathRules);
            }