Esempio n. 1
0
        private void AddSpecialCaseDetails(InnerError error) {
            if (!error.Data.ContainsKey(Error.KnownDataKeys.ExtraProperties))
                return;

            var extraProperties = error.Data.GetValue<Dictionary<string, object>>(Error.KnownDataKeys.ExtraProperties);
            if (extraProperties == null)
                return;

            if (extraProperties.ContainsKey("Number"))
                SignatureInfo.Add("Number", extraProperties["Number"].ToString());

            if (extraProperties.ContainsKey("ErrorCode"))
                SignatureInfo.Add("ErrorCode", extraProperties["ErrorCode"].ToString());
        }
Esempio n. 2
0
 protected bool Equals(InnerError other)
 {
     return(string.Equals(Message, other.Message) && string.Equals(Type, other.Type) && string.Equals(Code, other.Code) && Equals(Data, other.Data) && Equals(Inner, other.Inner) && StackTrace.CollectionEquals(other.StackTrace) && Equals(TargetMethod, other.TargetMethod));
 }
Esempio n. 3
0
        private void Compare(Exception ex, InnerError err, int level = 1)
        {
            Console.WriteLine("Level " + level);
            Assert.Equal(ex.GetType().FullName, err.Type);
            if (String.IsNullOrEmpty(ex.StackTrace))
                Assert.Equal(0, err.StackTrace.Count);
            else {
                string[] lines = Regex.Split(ex.StackTrace, "\r\n|\r|\n");
                Assert.Equal(lines.Length, err.StackTrace.Count);
                Assert.Equal(ex.StackTrace, err.StackTrace.ToString());
            }

            // TODO: Fix formatting bugs with inner exception tostring
            if (level == 1)
                Assert.Equal(ex.ToString(), err.ToString());

            if (ex.InnerException != null)
                Compare(ex.InnerException, err.Inner, level + 1);
        }
Esempio n. 4
0
 protected bool Equals(InnerError other) {
     return string.Equals(Message, other.Message) && string.Equals(Type, other.Type) && string.Equals(Code, other.Code) && Equals(Data, other.Data) && Equals(Inner, other.Inner) && StackTrace.CollectionEquals(other.StackTrace) && Equals(TargetMethod, other.TargetMethod);
 }