public void ValidateSerialization_NullFields() { FeedReadSessionNotAvailableException originalException = new FeedReadSessionNotAvailableException("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); FeedReadSessionNotAvailableException deserializedException = (FeedReadSessionNotAvailableException)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"; FeedReadSessionNotAvailableException ex = new FeedReadSessionNotAvailableException(message, lastContinuation); Assert.AreEqual(message, ex.Message); Assert.AreEqual(lastContinuation, ex.LastContinuation); Exception innerException = new Exception(); ex = new FeedReadSessionNotAvailableException(message, lastContinuation, innerException); Assert.AreEqual(message, ex.Message); Assert.AreEqual(innerException, ex.InnerException); Assert.AreEqual(lastContinuation, ex.LastContinuation); }