public void MeetCustomRule_MatchesFound_ClassSelected() { // Create a custom rule that selects "ClassA1" var rule = new CustomRuleExample(t => t.Name.Equals("ClassA1", StringComparison.InvariantCultureIgnoreCase)); // Use the custom rule var result = Types .InAssembly(Assembly.GetAssembly(typeof(ClassA1))) .That() .MeetCustomRule(rule) .GetTypes(); // ClassA1 has been returned Assert.Single(result); Assert.Equal <Type>(typeof(ClassA1), result.First()); // The custom rule was executed at least once Assert.True(rule.TestMethodCalled); }
public void MeetCustomRule_MatchesFound_ClassSelected() { // Create a custom rule that selected "ClassA1" var rule = new CustomRuleExample(t => t.Name.Equals("ClassA1", StringComparison.InvariantCultureIgnoreCase)); // This rule uses the custom rule to confirm that "ClassA1" has been selected var result = Types .InAssembly(Assembly.GetAssembly(typeof(ClassA1))) .That() .HaveName("ClassA1") .Should() .MeetCustomRule(rule) .GetResult(); // The custom rule selected the right class Assert.True(result.IsSuccessful); // The custom rule was executed at least once Assert.True(rule.TestMethodCalled); }