public void ValidateSerialization_NullFields() { FeedNotFoundException originalException = new FeedNotFoundException("message", null); byte[] buffer = new byte[4096]; BinaryFormatter formatter = new BinaryFormatter(); MemoryStream stream1 = new MemoryStream(buffer); MemoryStream stream2 = new MemoryStream(buffer); formatter.Serialize(stream1, originalException); FeedNotFoundException deserializedException = (FeedNotFoundException)formatter.Deserialize(stream2); Assert.AreEqual(originalException.Message, deserializedException.Message); Assert.IsNull(deserializedException.InnerException); Assert.IsNull(deserializedException.LastContinuation); }
public void ValidateRecommendedConstructors() { string message = "message"; string lastContinuation = "lastContinuation"; FeedNotFoundException ex = new FeedNotFoundException(message, lastContinuation); Assert.AreEqual(message, ex.Message); Assert.AreEqual(lastContinuation, ex.LastContinuation); Exception innerException = new Exception(); ex = new FeedNotFoundException(message, lastContinuation, innerException); Assert.AreEqual(message, ex.Message); Assert.AreEqual(innerException, ex.InnerException); Assert.AreEqual(lastContinuation, ex.LastContinuation); }