public void FullDefinitionMatch() { var matcher = MemberMatcher.Create("MyPropPrivate"); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivate))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtected))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivateStatic))).Should().BeFalse(); }
public void StaticOnlyConstructorMatching() { var matcher = MemberMatcher.Create("[static|constructor]*"); matcher.IsMatch(GetConstructorDefinition(true)).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivate))).Should().BeFalse(); matcher.IsMatch(GetStaticConstructorDefinition()).Should().BeTrue(); }
public void PartialDefinitionProtectedVisibility() { var matcher = MemberMatcher.Create("[protected]*Protected"); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtected))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtected))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropInternal))).Should().BeFalse(); }
public void ConstructorMatchingWithVisibility() { var matcher = MemberMatcher.Create("[protected|constructor]*"); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivate))).Should().BeFalse(); matcher.IsMatch(GetConstructorDefinition(true)).Should().BeFalse(); matcher.IsMatch(GetConstructorDefinition(false)).Should().BeTrue(); matcher.IsMatch(GetStaticConstructorDefinition()).Should().BeTrue(); }
public void PartialDefinitionIstancePrivate() { var matcher = MemberMatcher.Create("[instance|private]My*"); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivate))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtected))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropInternal))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPrivate))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtected))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivateStatic))).Should().BeFalse(); }
public void SortTest_NameWithoutStarFirst() { var matcher1 = MemberMatcher.Create("MyClass"); var matcher2 = MemberMatcher.Create("MyClassIsLongerButContains*"); var list = new List <MemberMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void SortTest_LongerNameFirstIfBothContainsStar() { var matcher1 = MemberMatcher.Create("My*Class"); var matcher2 = MemberMatcher.Create("*MyCl"); var list = new List <MemberMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void SortTest_LessQuestionMarksFirst() { var matcher1 = MemberMatcher.Create("MyClas?"); var matcher2 = MemberMatcher.Create("MyCla??"); var list = new List <MemberMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void SortTest_ScopeDefsDoesntMatter() { var matcher1 = MemberMatcher.Create("MyClass"); var matcher2 = MemberMatcher.Create("[public]MyCl"); var list = new List <MemberMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void PartialDefinitionAllVisibilityStatic() { var matcher = MemberMatcher.Create("My*"); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivateStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtectedStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropInternalStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPublicStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPrivateStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtectedStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodInternalStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtectedInternalStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPublicStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(OtherPropPublicStatic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(OtherMethodPublicStatic))).Should().BeFalse(); }
public void PartialDefinitionStaticSetters() { var matcher = MemberMatcher.Create("[static|set]My*"); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivateStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtectedStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropInternalStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPublicStatic))).Should().BeTrue(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPrivate))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropProtected))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropInternal))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyPropPublic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPrivate))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtected))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodInternal))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtectedInternal))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPublic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPrivateStatic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtectedStatic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodInternalStatic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodProtectedInternalStatic))).Should().BeFalse(); matcher.IsMatch(GetMethodDefinition(nameof(MyMethodPublicStatic))).Should().BeFalse(); }
public void EmptyMemberNameFails() { Action action = () => MemberMatcher.Create("[]"); action.Should().Throw <ArgumentException>(); }
public void PartialDefinitioGenericMethod() { var matcher = MemberMatcher.Create("My*"); matcher.IsMatch(GetMethodDefinition(nameof(MyGeneric))).Should().BeTrue(); }