示例#1
0
        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));
        }
示例#2
0
 public TestFailure(TestMatcherName name)
 {
     _name    = name;
     UserData = new UserDataCollection();
 }
示例#3
0
 internal TestFailure(TestMatcherName name, object matcher)
 {
     _name    = name;
     UserData = new UserDataCollection(matcher);
 }