Esempio n. 1
0
 /// <summary>
 /// Tests if actual is an instance of expected
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="expected"></param>
 /// <param name="customMessage"></param>
 public static void Of(
     this IInstanceContinuation instance,
     Type expected,
     string customMessage)
 {
     instance.Of(expected, () => customMessage);
 }
Esempio n. 2
0
        /// <summary>
        /// Tests if actual is an instance of TExpected
        /// </summary>
        /// <param name="instance">Instance to operate on</param>
        /// <param name="customMessageGenerator">Custom error message</param>
        /// <typeparam name="TExpected">Expected Type of the Instance</typeparam>
        public static void Of <TExpected>(
            this IInstanceContinuation instance,
            Func <string> customMessageGenerator)
        {
            instance.Of(typeof(TExpected), customMessageGenerator);
//            instance.AddMatcher(
//                expected =>
//                {
//                    var theExpectedType = typeof(TExpected);
//                    var passed = theExpectedType.IsAssignableFrom(instance.Actual);
//                    return new MatcherResult(
//                        passed,
//                        FinalMessageFor(
//                            new[]
//                            {
//                                "Expected",
//                                $"<{instance.Actual.PrettyName()}>",
//                                $"to {passed.AsNot()}be an instance of",
//                                $"<{theExpectedType.PrettyName()}>"
//                            },
//                            customMessageGenerator
//                        ));
//                });
        }
Esempio n. 3
0
 /// <summary>
 /// Tests if actual is an instance of expected
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="expected"></param>
 public static void Of(
     this IInstanceContinuation instance,
     Type expected)
 {
     instance.Of(expected, null as string);
 }
Esempio n. 4
0
 /// <summary>
 /// Tests if actual is an instance of TExpected
 /// </summary>
 /// <param name="instance">Instance to operate on</param>
 /// <param name="customMessage">Custom error message</param>
 /// <typeparam name="TExpected">Expected Type of the Instance</typeparam>
 public static void Of <TExpected>(
     this IInstanceContinuation instance,
     string customMessage)
 {
     instance.Of <TExpected>(() => customMessage);
 }
Esempio n. 5
0
 /// <summary>
 /// Tests if actual is an instance of TExpected
 /// </summary>
 /// <param name="instance">Instance to operate on</param>
 /// <param name="customMessage">Custom error message</param>
 /// <typeparam name="TExpected">Expected Type of the Instance</typeparam>
 public static IMore <TExpected> Of <TExpected>(
     this IInstanceContinuation instance,
     string customMessage)
 {
     return(instance.Of <TExpected>(() => customMessage));
 }