public void Constructor() { ProjectReloadedException ex = new ProjectReloadedException(); Assert.AreEqual("The project was reloaded, and some changes on this page may have been lost.", ex.Message); Assert.IsNull(ex.InnerException); Assert.AreEqual(0, ex.Data.Count); }
public void CanBeSerializedCorrectly() { ProjectReloadedException ex1 = new ProjectReloadedException(); MemoryStream ms = new MemoryStream(); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bf.Serialize(ms, ex1); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); Object o = bf.Deserialize(ms); Assert.IsInstanceOfType(o, typeof(ProjectReloadedException)); ProjectReloadedException ex2 = (ProjectReloadedException)o; Assert.AreEqual(ex1.Data.Count, ex2.Data.Count); Assert.AreEqual(ex1.InnerException, ex2.InnerException); Assert.AreEqual(ex1.Message, ex2.Message); Assert.AreEqual(ex1.StackTrace, ex2.StackTrace); Assert.AreEqual(ex1.ToString(), ex2.ToString()); }