Exemple #1
0
        private bool CompareNestetedDictionary()
        {
            bool compare = true;

            foreach (KeyValuePair <string, Dictionary <string, string> > className in _expected)
            {
                foreach (KeyValuePair <string, string> property in className.Value)
                {
                    try
                    {
                        if (property.Value != _output[className.Key][property.Key])
                        {
                            var e = new InvalidXmlException();
                            e.Property  = property;
                            e.ClassName = className;
                            throw e;
                        }
                    }
                    catch
                    {
                        _errorMsg = className.Key + "-" + property.Key + ":" + property.Value;
                        if (!_output.ContainsKey(className.Key))
                        {
                            _errorMsg = className.Key + " Key is missing";
                            foreach (string k in _output.Keys)
                            {
                                _errorMsg += "\n " + k;
                            }
                        }
                        else if (!_output[className.Key].ContainsKey(property.Key))
                        {
                            _errorMsg = property.Key + " Key is missing";
                        }
                        else
                        {
                            _errorMsg += " Value is:" + _output[className.Key][property.Key];
                        }
                        compare = false;
                        return(compare);
                    }
                }
            }
            return(compare);
        }
Exemple #2
0
        private bool CompareNestetedDictionary()
        {
            bool compare = true;
            foreach (KeyValuePair<string, Dictionary<string, string>> className in _expected)
            {
                foreach (KeyValuePair<string, string> property in className.Value)
                {
					try
					{
                    if (property.Value != _output[className.Key][property.Key])
						{
							var e = new InvalidXmlException();
							e.Property = property;
							e.ClassName = className;
							throw e;
						}
					}
				    catch
                    {
                        _errorMsg = className.Key + "-" + property.Key + ":" + property.Value;
						if (!_output.ContainsKey(className.Key))
						{
							_errorMsg = className.Key + " Key is missing";
							foreach (string k in _output.Keys)
								_errorMsg += "\n " + k;
						}
						else if (!_output[className.Key].ContainsKey(property.Key))
							_errorMsg = property.Key + " Key is missing";
						else
						{
							_errorMsg += " Value is:" + _output[className.Key][property.Key];
						}
                        compare = false;
                        return compare;
                    }
                }
            }
            return compare;
        }