Esempio n. 1
0
        public void MultiNamespaceTwoDottedAtBeginningMatches()
        {
            var def = PatternDefinition.BuildUpDefinition("..MyClass.MyMethod", true);

            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.Inner.AndMore.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.Inner.AndMore.MyClass), "OtherMethod")).Should().BeFalse();
        }
Esempio n. 2
0
        public void FullSpecifiedMatches()
        {
            var def = PatternDefinition.BuildUpDefinition("Mynamespace.MyClass.MyMethod", true);

            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.MyClass), "OtherMethod")).Should().BeFalse();
        }
Esempio n. 3
0
        public void MatchEveryPublicClass()
        {
            var def = PatternDefinition.BuildUpDefinition("..[public]*.*", true);

            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.Inner.AndMore.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.OtherClass), "MyMethod")).Should().BeFalse();
        }
Esempio n. 4
0
        public void MultiNamespaceUsingStar()
        {
            var def = PatternDefinition.BuildUpDefinition("MyNamespace.*.AndMore.MyClass.MyMethod", true);

            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.Inner.AndMore.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.Other.AndMore.MyClass), "MyMethod")).Should().BeTrue();
            def.IsMatching(TestHelpers.GetMethodDefinition(typeof(MyNamespace.MyClass), "MyMethod")).Should().BeFalse();
        }
Esempio n. 5
0
        public void SortRestrictionTest()
        {
            var def1 = PatternDefinition.BuildUpDefinition("*", true);
            var def2 = PatternDefinition.BuildUpDefinition("..[public]*.[public|method]*", true);
            var def3 = PatternDefinition.BuildUpDefinition("..[public|internal]*.[public|method]*", true);

            var list = new List <PatternDefinition> {
                def1, def2, def3
            };

            list.Sort();
            list[0].Should().BeSameAs(def3);
            list[1].Should().BeSameAs(def2);
            list[2].Should().BeSameAs(def1);
        }
Esempio n. 6
0
        public void SortRestrictionTestNextLevelSpecifiedVsNextlevelAll3()
        {
            var def1 = PatternDefinition.BuildUpDefinition("*", true);
            var def2 = PatternDefinition.BuildUpDefinition("Whatever..*.Cre", true);
            var def3 = PatternDefinition.BuildUpDefinition("..*.Equals", true);

            var list = new List <PatternDefinition> {
                def1, def2, def3
            };

            list.Sort();
            list[0].Should().BeSameAs(def2);
            list[1].Should().BeSameAs(def3);
            list[2].Should().BeSameAs(def1);
        }
Esempio n. 7
0
        public void SortTest()
        {
            var def1 = PatternDefinition.BuildUpDefinition("MyNs.Inner.Other.[public]MyClass.MyMethod", true);
            var def2 = PatternDefinition.BuildUpDefinition("MyNs.Inner.Other.[public]MyClass.My*", true);
            var def3 = PatternDefinition.BuildUpDefinition("MyNs.Inner.Other.My*.MyMethod", true);
            var def4 = PatternDefinition.BuildUpDefinition("MyNs.Inner.Other.*.*", true);
            var def5 = PatternDefinition.BuildUpDefinition("MyNs..Other.*.*", true);
            var def6 = PatternDefinition.BuildUpDefinition("..*.*", true);

            var list = new List <PatternDefinition> {
                def6, def4, def1, def3, def5, def2
            };

            list.Sort();
            list[0].Should().BeSameAs(def1);
            list[1].Should().BeSameAs(def2);
            list[2].Should().BeSameAs(def3);
            list[3].Should().BeSameAs(def4);
            list[4].Should().BeSameAs(def5);
            list[5].Should().BeSameAs(def6);
        }