Exemple #1
0
        /// <summary>
        /// Ensure exception is not a Moq exception or any other mocking exception used in TestFirst
        /// </summary>
        /// <returns></returns>
        public AnException NotMockException()
        {
            var text1 = AString.Not(AString.ContainingOfAnyCase("mock behavior Strict"));
            var text2 = AString.Not(AString.ContainingOfAnyCase("mock must have a corresponding setup"));

            Message(text1);
            Message(text2);

            StackTrace(text1);
            StackTrace(text2);

            return(this);
        }
Exemple #2
0
        public static IMatcher <T> EqualTo <T>(T expect)
        {
            if (expect != null)
            {
                if (expect is String)
                {
                    return((IMatcher <T>)AString.EqualTo(expect as String));
                }
                Type t = typeof(T);
                if (t.IsPrimitive || t.IsValueType)
                {
                    return(Matchers.Function((T actual) => actual.Equals(expect), typeof(T).Name + " == " + expect));
                }
                if (expect is TimeSpan)
                {
                    return((IMatcher <T>)ATimeSpan.EqualTo(expect as TimeSpan?));
                }
                if (expect is Uri)
                {
                    return((IMatcher <T>)AnUri.EqualTo(expect as Uri));
                }
                if (expect is DateTime)
                {
                    return((IMatcher <T>)ADateTime.EqualTo(expect as DateTime?));
                }
                if (expect is DateTimeOffset)
                {
                    return((IMatcher <T>)ADateTimeOffset.EqualTo(expect as DateTimeOffset?));
                }
            }

            return(EqualTo(expect, () =>
            {
                if (expect != null)
                {
                    return "The instance " + expect.GetHashCode() + "@" + typeof(T).FullName + " => " + expect.ToPrettyString();
                }
                else
                {
                    return "Null instance of type " + typeof(T).FullName;
                }
            }));
        }
 public AFileInfo FullName(String path)
 {
     FullName(AString.EqualTo(path));
     return(this);
 }
Exemple #4
0
 public static IMatcher <Uri> EqualTo(String fullPath)
 {
     return(EqualTo(AString.EqualTo(fullPath)));
 }
Exemple #5
0
 public ACookie Path(String name)
 {
     Path(AString.EqualTo(name));
     return(this);
 }
Exemple #6
0
 public ACookie Value(String name)
 {
     Value(AString.EqualTo(name));
     return(this);
 }
Exemple #7
0
 public ACookie Name(String name)
 {
     Name(AString.EqualTo(name));
     return(this);
 }
 public ADictionary KeyMatching(string key, string value)
 {
     return(KeyMatching(key, AString.EqualTo(value)));
 }
Exemple #9
0
 /// <summary>
 /// In cases where the underlying exception class is not visible (like in third party libs)
 /// </summary>
 /// <param name="fullTypeName">the expected fully qualifed type name of the exception</param>
 /// <returns></returns>
 public AnException Type(String fullTypeName)
 {
     Type(AString.EqualTo(fullTypeName));
     return(this);
 }
Exemple #10
0
 public AnException Message(String val)
 {
     Message(AString.EqualTo(val));
     return(this);
 }
Exemple #11
0
 public static IMatcher <string> IgnoringSlashType(string path)
 {
     path = path.Replace("\\", "/");
     return(WithForwardSlashes(AString.EqualTo(path)));
 }
 public AnIdentity AuthenticationType(String val)
 {
     WithProperty(() => PropertyNames.AuthenticationType, AString.EqualTo(val));
     return(this);
 }
 public AnIdentity Name(String val)
 {
     Name(AString.EqualTo(val));
     return(this);
 }