public void constructor_should_initialize_subject()
        {
            var subject = new MongoConnectionClosedException(_connectionId);

            subject.ConnectionId.Should().BeSameAs(_connectionId);
            subject.InnerException.Should().BeNull();
            subject.Message.Should().BeSameAs("The connection was closed while we were waiting our turn to use it.");
        }
        public void constructor_should_initialize_subject()
        {
            var subject = new MongoConnectionClosedException(_connectionId);

            subject.ConnectionId.Should().BeSameAs(_connectionId);
            subject.InnerException.Should().BeNull();
            subject.Message.Should().BeSameAs("The connection was closed while we were waiting our turn to use it.");
        }
        public void Serialization_should_work()
        {
            var subject = new MongoConnectionClosedException(_connectionId);

            var formatter = new BinaryFormatter();
            using (var stream = new MemoryStream())
            {
                formatter.Serialize(stream, subject);
                stream.Position = 0;
                var rehydrated = (MongoConnectionClosedException)formatter.Deserialize(stream);

                rehydrated.ConnectionId.Should().Be(subject.ConnectionId);
                rehydrated.InnerException.Should().BeNull();
                rehydrated.Message.Should().Be(subject.Message);
            }
        }
        public void Serialization_should_work()
        {
            var subject = new MongoConnectionClosedException(_connectionId);

            var formatter = new BinaryFormatter();

            using (var stream = new MemoryStream())
            {
                formatter.Serialize(stream, subject);
                stream.Position = 0;
                var rehydrated = (MongoConnectionClosedException)formatter.Deserialize(stream);

                rehydrated.ConnectionId.Should().Be(subject.ConnectionId);
                rehydrated.InnerException.Should().BeNull();
                rehydrated.Message.Should().Be(subject.Message);
            }
        }