Пример #1
0
        public SimpleError GenerateSimpleError(int maxErrorNestingLevel = 3, bool generateData = true, int currentNestingLevel = 0) {
            var error = new SimpleError { Message = @"Generated exception message.", Type = ExceptionTypes.Random() };
            if (generateData) {
                for (int i = 0; i < RandomData.GetInt(1, 5); i++) {
                    string key = RandomData.GetWord();
                    while (error.Data.ContainsKey(key) || key == Event.KnownDataKeys.Error)
                        key = RandomData.GetWord();

                    error.Data.Add(key, RandomData.GetString());
                }
            }

            error.StackTrace = RandomData.GetString();

            if (currentNestingLevel < maxErrorNestingLevel && RandomData.GetBool())
                error.Inner = GenerateSimpleError(maxErrorNestingLevel, generateData, currentNestingLevel + 1);

            return error;
        }
Пример #2
0
 protected bool Equals(SimpleError other)
 {
     return(String.Equals(Message, other.Message) && String.Equals(Type, other.Type) && String.Equals(StackTrace, other.StackTrace) && Equals(Data, other.Data) && Equals(Inner, other.Inner));
 }
Пример #3
0
 protected bool Equals(SimpleError other)
 {
     return string.Equals(Message, other.Message) && string.Equals(Type, other.Type) && string.Equals(StackTrace, other.StackTrace) && Equals(Data, other.Data) && Equals(Inner, other.Inner);
 }