public void MatchesShouldThrowOnNullAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("ns.name").Matches(null);
            ArgumentNullException exception = Assert.Throws <ArgumentNullException>(action);

            Assert.Contains("annotationName", exception.Message);
        }
        public void TestCreateIncludeAllFilter()
        {
            var filter = AnnotationFilter.CreateIncludeAllFilter();

            Assert.True(filter.Matches("any.any"));
            Assert.Equal(filter.GetType(), AnnotationFilter.Create("*").GetType());
        }
        public void CreateWithExcludeAllPatternShouldCreateExcludeAllFilter(string filterString)
        {
            var filter = AnnotationFilter.Create(filterString);

            Assert.False(filter.Matches("any.any"));
            Assert.False(filter.Matches("ns.name"));
        }
        public void CreateWithWildCardAndNoExcludePatternShouldCreateIncludeAllFilter()
        {
            var filter = AnnotationFilter.Create("ns.name,*");

            Assert.True(filter.Matches("any.any"));
            Assert.True(filter.Matches("ns.name"));
        }
        public void IncludeAllMatchesShouldThrowOnEmptyAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("*").Matches("");
            ArgumentNullException exception = Assert.Throws <ArgumentNullException>(action);

            Assert.Contains("annotationName", exception.Message);
        }
Ejemplo n.º 6
0
        public void ExcludesShouldWinOverIncludes()
        {
            var filter = AnnotationFilter.Create("*,ns.name, -ns.name,ns2.*, -ns2.*");

            filter.Matches("any.any").Should().BeTrue();
            filter.Matches("ns.name").Should().BeFalse();
            filter.Matches("ns2.any").Should().BeFalse();
        }
Ejemplo n.º 7
0
        public void MultipleExcludesShouldWork()
        {
            var filter = AnnotationFilter.Create("*,-ns.name, -ns2.*");

            filter.Matches("any.any").Should().BeTrue();
            filter.Matches("ns.name").Should().BeFalse();
            filter.Matches("ns2.any").Should().BeFalse();
        }
Ejemplo n.º 8
0
 public void CreateWithNullOrEmptyShouldCreateExcludeAllFilter()
 {
     foreach (string filterString in new string[] { null, "" })
     {
         var filter = AnnotationFilter.Create(filterString);
         filter.Matches("any.any").Should().BeFalse();
     }
 }
Ejemplo n.º 9
0
        public void ExcludeExactMatchPatternShouldWork()
        {
            var filter = AnnotationFilter.Create("*,-ns.name");

            filter.Matches("any.any").Should().BeTrue();
            filter.Matches("ns.name2").Should().BeTrue();
            filter.Matches("ns.name").Should().BeFalse();
        }
Ejemplo n.º 10
0
        public void TestCreateInclueAllFilter()
        {
            var filter = AnnotationFilter.CreateInclueAllFilter();

            filter.Matches("any.any").Should().BeTrue();

            filter.GetType().Should().Equals(AnnotationFilter.Create("*").GetType());
        }
        public void ExcludeExactMatchPatternShouldWork()
        {
            var filter = AnnotationFilter.Create("*,-ns.name");

            Assert.True(filter.Matches("any.any"));
            Assert.True(filter.Matches("ns.name2"));
            Assert.False(filter.Matches("ns.name"));
        }
        public void MultipleExcludesShouldWork()
        {
            var filter = AnnotationFilter.Create("*,-ns.name, -ns2.*");

            Assert.True(filter.Matches("any.any"));
            Assert.False(filter.Matches("ns.name"));
            Assert.False(filter.Matches("ns2.any"));
        }
        public void CreateWithNoIncludePatternShouldCreateExcludeAllFilter()
        {
            var filter = AnnotationFilter.Create("-ns1.name,-ns2.*");

            Assert.False(filter.Matches("any.any"));
            Assert.False(filter.Matches("ns1.name"));
            Assert.False(filter.Matches("ns2.any"));
        }
        public void ExcludesShouldWinOverIncludes()
        {
            var filter = AnnotationFilter.Create("*,ns.name, -ns.name,ns2.*, -ns2.*");

            Assert.True(filter.Matches("any.any"));
            Assert.False(filter.Matches("ns.name"));
            Assert.False(filter.Matches("ns2.any"));
        }
Ejemplo n.º 15
0
 public void CreateWithExcludeAllPatternShouldCreateExcludeAllFilter()
 {
     foreach (string filterString in new string[] { "*,-*", "-ns.name,-*,*" })
     {
         var filter = AnnotationFilter.Create(filterString);
         filter.Matches("any.any").Should().BeFalse();
         filter.Matches("ns.name").Should().BeFalse();
     }
 }
Ejemplo n.º 16
0
        public void IncludeStartsWithPatternShouldWork()
        {
            var filter = AnnotationFilter.Create("ns.*,NS.SubNS.*");

            filter.Matches("ns.any").Should().BeTrue();
            filter.Matches("ns.ns2.ns3.any").Should().BeTrue();
            filter.Matches("NS.any").Should().BeFalse();
            filter.Matches("NS.SubNS.any").Should().BeTrue();
            filter.Matches("any.any").Should().BeFalse();
        }
        public void ExcludeStartsWithPatternShouldWork()
        {
            var filter = AnnotationFilter.Create("*,-ns.*,-NS.SubNS.*");

            Assert.False(filter.Matches("ns.any"));
            Assert.False(filter.Matches("ns.ns2.ns3.any"));
            Assert.True(filter.Matches("NS.any"));
            Assert.False(filter.Matches("NS.SubNS.any"));
            Assert.True(filter.Matches("any.any"));
        }
        public void TheMoreSpecificPatternInTheFilterShouldWinWhenMultiplePatternsMatch()
        {
            var filter = AnnotationFilter.Create("-*,ns.*,-ns.sub1.*,ns.sub1.sub2.*,-ns.sub1.sub2.sub3.*,ns.sub1.sub2.sub3.match");

            Assert.True(filter.Matches("ns.sub1.sub2.sub3.match"));
            Assert.False(filter.Matches("ns.sub1.sub2.sub3.notmatch"));
            Assert.True(filter.Matches("ns.sub1.sub2.match"));
            Assert.False(filter.Matches("ns.sub1.notmatch"));
            Assert.True(filter.Matches("ns.match"));
            Assert.False(filter.Matches("notmatch.any"));
        }
Ejemplo n.º 19
0
        public void MatchesShouldThrowOnNullAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("ns.name").Matches(null);

            action.ShouldThrow <ArgumentNullException>().WithMessage("annotationName", ComparisonMode.Substring);
        }
Ejemplo n.º 20
0
        public void MatchesShouldThrowOnNullAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("ns.name").Matches(null);

            action.ShouldThrow <ArgumentNullException>().Where(e => e.Message.Contains("annotationName"));
        }
        public void CreateWithWildCardShouldCreateIncludeAllFilter()
        {
            var filter = AnnotationFilter.Create("*");

            Assert.True(filter.Matches("any.any"));
        }
        public void TheExcludePatternShouldWinWhenBothTheIncludeAndExcludePatternsMatch()
        {
            var filter = AnnotationFilter.Create("ns.name,-ns.name");

            Assert.False(filter.Matches("ns.name"));
        }
        public void CreateWithNullOrEmptyShouldCreateExcludeAllFilter(string filterString)
        {
            var filter = AnnotationFilter.Create(filterString);

            Assert.False(filter.Matches("any.any"));
        }
Ejemplo n.º 24
0
        public void IncludeAllMatchesShouldThrowOnEmptyAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("*").Matches("");

            action.ShouldThrow <ArgumentNullException>().WithMessage("annotationName", ComparisonMode.Substring);
        }
Ejemplo n.º 25
0
        public void CreateWithWildCardShouldCreateIncludeAllFilter()
        {
            var filter = AnnotationFilter.Create("*");

            filter.Matches("any.any").Should().BeTrue();
        }
Ejemplo n.º 26
0
        public void IncludeAllMatchesShouldThrowOnEmptyAnnotationName()
        {
            Action action = () => AnnotationFilter.Create("*").Matches("");

            action.ShouldThrow <ArgumentNullException>().Where(e => e.Message.Contains("annotationName"));
        }