public void PartialDefinitionVisibilityPrefix_InternalOnly() { var matcher = ClassMatcher.Create("[internal]My*"); matcher.IsMatch(GetTypeDefinition(typeof(MyClass))).Should().BeFalse(); matcher.IsMatch(GetTypeDefinition(typeof(MyOtherClass))).Should().BeFalse(); matcher.IsMatch(GetTypeDefinition(typeof(MyStruct))).Should().BeFalse(); matcher.IsMatch(GetTypeDefinition(typeof(MyInternalClass))).Should().BeTrue(); }
public void PartialDefinitionWithoutPrefixMatchAtEnd() { var matcher = ClassMatcher.Create("*Class"); matcher.IsMatch(GetTypeDefinition(typeof(MyClass))).Should().BeTrue(); matcher.IsMatch(GetTypeDefinition(typeof(YourClass))).Should().BeTrue(); matcher.IsMatch(GetTypeDefinition(typeof(MyOtherClass))).Should().BeTrue(); matcher.IsMatch(GetTypeDefinition(typeof(MyStruct))).Should().BeFalse(); matcher.IsMatch(GetTypeDefinition(typeof(MyInternalClass))).Should().BeTrue(); }
public void SortTest_NameWithoutStarFirst() { var matcher1 = ClassMatcher.Create("MyClass"); var matcher2 = ClassMatcher.Create("MyClassIsLongerButContains*"); var list = new List <ClassMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void SortTest_LongerNameFirstIfBothContainsStar() { var matcher1 = ClassMatcher.Create("My*Class"); var matcher2 = ClassMatcher.Create("*MyCl"); var list = new List <ClassMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().Be(matcher1); list[1].Should().Be(matcher2); }
public void SortTest_LessQuestionMarksFirst() { var matcher1 = ClassMatcher.Create("MyClas?"); var matcher2 = ClassMatcher.Create("MyCla??"); var list = new List <ClassMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().BeSameAs(matcher1); list[1].Should().BeSameAs(matcher2); }
public void SortTest_ScopeDefsMatterLessThanNameLength() { var matcher1 = ClassMatcher.Create("MyClass"); var matcher2 = ClassMatcher.Create("[public]MyCl"); var list = new List <ClassMatcher> { matcher2, matcher1 }; list.Sort(); list[0].Should().BeSameAs(matcher1); list[1].Should().BeSameAs(matcher2); }
public void InvalidKeywordFails() { Action action = () => ClassMatcher.Create("[private]MyClass"); action.Should().Throw <ArgumentException>(); }
public void EmptyClassNameFails() { Action action = () => ClassMatcher.Create("[]"); action.Should().Throw <ArgumentException>(); }
public void PartialDefinitionGenericInstanceClass() { var matcher = ClassMatcher.Create("My*"); matcher.IsMatch(GetGenericTypeDefinition(typeof(MyGeneric <>), typeof(string))).Should().BeTrue(); }
public void PartialDefinitionGenericClass() { var matcher = ClassMatcher.Create("My*"); matcher.IsMatch(GetTypeDefinition(typeof(MyGeneric <>))).Should().BeTrue(); }
public void SealedPublicClassShouldBeConsideredAsPublic() { var matcher = ClassMatcher.Create("[public]My*"); matcher.IsMatch(GetTypeDefinition(typeof(MySealedClass))).Should().BeTrue(); }