/// <summary> /// Creates an exception data object. /// </summary> /// <param name="type">The exception type full name.</param> /// <param name="message">The exception message text.</param> /// <param name="stackTrace">The exception stack trace.</param> /// <param name="properties">The exception properties, or <see cref="NoProperties"/> /// if none.</param> /// <param name="innerException">The inner exception data, or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="type"/>, /// <paramref name="message"/>, <paramref name="properties"/> /// or <paramref name="stackTrace"/> is null.</exception> public ExceptionData(string type, string message, StackTraceData stackTrace, PropertySet properties, ExceptionData innerException) { if (type == null) { throw new ArgumentNullException("type"); } if (message == null) { throw new ArgumentNullException("message"); } if (stackTrace == null) { throw new ArgumentNullException("stackTrace"); } if (properties == null) { throw new ArgumentNullException("properties"); } this.type = type; this.message = message; this.stackTrace = stackTrace; this.properties = properties.Count == 0 ? NoProperties : properties.AsReadOnly(); this.innerException = innerException; }
public void AsReadOnly() { PropertySet original = new PropertySet(); original.Add("abc", "123"); PropertySet readOnly = original.AsReadOnly(); Assert.IsTrue(readOnly.IsReadOnly); AssertAreEqual(original, readOnly); MbUnit.Framework.Assert.Throws <NotSupportedException>(delegate { readOnly.Add("def", "456"); }); }
public void AsReadOnly() { PropertySet original = new PropertySet(); original.Add("abc", "123"); PropertySet readOnly = original.AsReadOnly(); Assert.IsTrue(readOnly.IsReadOnly); AssertAreEqual(original, readOnly); MbUnit.Framework.Assert.Throws<NotSupportedException>(delegate { readOnly.Add("def", "456"); }); }