Пример #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);
        }
Пример #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;
                }
            }));
        }
Пример #3
0
 public AFileInfo FullName(String path)
 {
     FullName(AString.EqualTo(path));
     return(this);
 }
Пример #4
0
 public static IMatcher <Uri> EqualTo(String fullPath)
 {
     return(EqualTo(AString.EqualTo(fullPath)));
 }
Пример #5
0
 public ACookie Path(String name)
 {
     Path(AString.EqualTo(name));
     return(this);
 }
Пример #6
0
 public ACookie Value(String name)
 {
     Value(AString.EqualTo(name));
     return(this);
 }
Пример #7
0
 public ACookie Name(String name)
 {
     Name(AString.EqualTo(name));
     return(this);
 }
Пример #8
0
 public ADictionary KeyMatching(string key, string value)
 {
     return(KeyMatching(key, AString.EqualTo(value)));
 }
Пример #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);
 }
Пример #10
0
 public AnException Message(String val)
 {
     Message(AString.EqualTo(val));
     return(this);
 }
Пример #11
0
 public static IMatcher <string> IgnoringSlashType(string path)
 {
     path = path.Replace("\\", "/");
     return(WithForwardSlashes(AString.EqualTo(path)));
 }
Пример #12
0
 public AnIdentity AuthenticationType(String val)
 {
     WithProperty(() => PropertyNames.AuthenticationType, AString.EqualTo(val));
     return(this);
 }
Пример #13
0
 public AnIdentity Name(String val)
 {
     Name(AString.EqualTo(val));
     return(this);
 }