public static TestMatcherName For(object matcher)
        {
            if (matcher is TestMatcher.IInvariantTestMatcher invariant)
            {
                return(invariant.Matches() ? "Anything" : "Nothing");
            }
            if (matcher is ISupportTestMatcher support)
            {
                return(For(support.RealMatcher));
            }
            if (matcher is INotMatcher nt)
            {
                return(For(nt.InnerMatcher).Negated());
            }

            var matcherType = matcher.GetType().GetTypeInfo();

            if (matcherType.IsGenericType)
            {
                matcherType = matcherType.GetGenericTypeDefinition().GetTypeInfo();
            }

            return(TestMatcherName.FromType(matcherType));
        }
Exemple #2
0
 public TestFailure(TestMatcherName name)
 {
     _name    = name;
     UserData = new UserDataCollection();
 }
Exemple #3
0
 internal TestFailure(TestMatcherName name, object matcher)
 {
     _name    = name;
     UserData = new UserDataCollection(matcher);
 }