public void constructor_should_initialize_subject() { var subject = new MongoMessageNotSentException(_connectionId); subject.ConnectionId.Should().BeSameAs(_connectionId); subject.InnerException.Should().BeNull(); subject.Message.Should().BeSameAs("Message not sent."); }
public void Serialization_should_work() { var subject = new MongoMessageNotSentException(_connectionId); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (MongoMessageNotSentException)formatter.Deserialize(stream); rehydrated.ConnectionId.Should().Be(subject.ConnectionId); rehydrated.InnerException.Should().BeNull(); rehydrated.Message.Should().Be(subject.Message); } }