예제 #1
0
        public void Visit(IMSBuildGlob glob)
        {
            var msbuildGlob = glob as MSBuildGlob;

            if (msbuildGlob != null)
            {
                VisitMSBuildGlob(msbuildGlob);
            }

            var compositGlob = glob as CompositeGlob;

            if (compositGlob != null)
            {
                VisitCompositeGlob(compositGlob);

                foreach (var globPart in compositGlob.Globs)
                {
                    Visit(globPart);
                }
            }

            var globWithGaps = glob as MSBuildGlobWithGaps;

            if (globWithGaps != null)
            {
                VisitGlobWithGaps(globWithGaps);

                Visit(globWithGaps.MainGlob);
            }
        }
예제 #2
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="mainGlob">The main glob</param>
        /// <param name="gaps">The gap glob</param>
        public MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IEnumerable <IMSBuildGlob> gaps)
        {
            ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob));
            ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps));

            MainGlob = mainGlob;
            Gaps     = new CompositeGlob(gaps);
        }
예제 #3
0
        public static IEnumerable <MSBuildGlob> GetParsedGlobs(this IMSBuildGlob glob)
        {
            var parsedGlobVisitor = new ParsedGlobCollector();

            parsedGlobVisitor.Visit(glob);

            return(parsedGlobVisitor.CollectedGlobs);
        }
예제 #4
0
        internal MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IMSBuildGlob gaps)
        {
            ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob));
            ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps));

            MainGlob = mainGlob;
            Gaps     = gaps;
        }
예제 #5
0
        public void CreateShouldReturnSingleChildUnchanged()
        {
            var glob = MSBuildGlob.Parse("");

            IMSBuildGlob composite = CompositeGlob.Create(new[] { glob });

            Assert.Same(glob, composite);
        }
예제 #6
0
        public void CreateShouldReturnNewCompositeWhenMultipleProvided()
        {
            var glob1 = MSBuildGlob.Parse("");
            var glob2 = MSBuildGlob.Parse("");

            IMSBuildGlob result = CompositeGlob.Create(new[] { glob1, glob2 });

            var composite = Assert.IsType <CompositeGlob>(result);

            Assert.Same(glob1, composite.Globs.First());
            Assert.Same(glob2, composite.Globs.Skip(1).First());
            Assert.Equal(2, composite.Globs.Count());
        }
예제 #7
0
        public void Visit(IMSBuildGlob glob)
        {
            if (glob is MSBuildGlob msbuildGlob)
            {
                VisitMSBuildGlob(msbuildGlob);
            }

            if (glob is CompositeGlob compositeGlob)
            {
                VisitCompositeGlob(compositeGlob);

                foreach (var globPart in compositeGlob.Globs)
                {
                    Visit(globPart);
                }
            }

            if (glob is MSBuildGlobWithGaps globWithGaps)
            {
                VisitGlobWithGaps(globWithGaps);

                Visit(globWithGaps.MainGlob);
            }
        }
예제 #8
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="glob1">First child glob.</param>
 /// <param name="glob2">Second child glob.</param>
 internal CompositeGlob(IMSBuildGlob glob1, IMSBuildGlob glob2)
     : this(ImmutableArray.Create(glob1, glob2))
 {
 }
예제 #9
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="mainGlob">The main glob</param>
 /// <param name="gaps">The gap glob</param>
 public MSBuildGlobWithGaps(IMSBuildGlob mainGlob, params IMSBuildGlob[] gaps) : this(mainGlob, gaps.AsEnumerable())
 {
 }
예제 #10
0
        public void CreateShouldHandleZeroChildren()
        {
            IMSBuildGlob composite = CompositeGlob.Create(Enumerable.Empty <IMSBuildGlob>());

            Assert.False(composite.IsMatch(""));
        }