public void constructor_should_initialize_subject() { var subject = new MongoDuplicateKeyException(_connectionId, _message, _writeConcernResult); subject.Command.Should().BeNull(); subject.ConnectionId.Should().BeSameAs(_connectionId); subject.InnerException.Should().BeNull(); subject.Message.Should().BeSameAs(_message); subject.Result.Should().Be(_writeConcernResult.Response); subject.WriteConcernResult.Should().Be(_writeConcernResult); }
public void constructor_should_initialize_subject() { var subject = new MongoDuplicateKeyException(_connectionId, _message, _writeConcernResult); subject.Command.Should().BeNull(); subject.ConnectionId.Should().BeSameAs(_connectionId); subject.InnerException.Should().BeNull(); subject.Message.Should().BeSameAs(_message); subject.Result.Should().Be(_writeConcernResult.Response); subject.WriteConcernResult.Should().Be(_writeConcernResult); }
public void Serialization_should_work() { var subject = new MongoDuplicateKeyException(_connectionId, _message, _writeConcernResult); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (MongoDuplicateKeyException)formatter.Deserialize(stream); rehydrated.Command.Should().BeNull(); rehydrated.ConnectionId.Should().Be(subject.ConnectionId); rehydrated.InnerException.Should().BeNull(); rehydrated.Message.Should().Be(subject.Message); rehydrated.Result.Should().Be(subject.Result); rehydrated.WriteConcernResult.Should().BeUsing(subject.WriteConcernResult, EqualityComparerRegistry.Default); } }
public void Serialization_should_work() { var subject = new MongoDuplicateKeyException(_connectionId, _message, _writeConcernResult); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (MongoDuplicateKeyException)formatter.Deserialize(stream); rehydrated.Command.Should().BeNull(); rehydrated.ConnectionId.Should().Be(subject.ConnectionId); rehydrated.InnerException.Should().BeNull(); rehydrated.Message.Should().Be(subject.Message); rehydrated.Result.Should().Be(subject.Result); rehydrated.WriteConcernResult.Should().BeUsing(subject.WriteConcernResult, EqualityComparerRegistry.Default); } }