public void constructor_should_initialize_subject() { var subject = new MongoNodeIsRecoveringException(_connectionId, _serverResult); subject.ConnectionId.Should().BeSameAs(_connectionId); subject.InnerException.Should().BeNull(); subject.Message.Should().Be("Server returned node is recovering error."); subject.Result.Should().Be(_serverResult); }
public void constructor_should_initialize_subject() { var result = new MongoNodeIsRecoveringException(_connectionId, _serverResult); result.ConnectionId.Should().BeSameAs(_connectionId); result.InnerException.Should().BeNull(); result.Message.Should().Be("Server returned node is recovering error (code = -1)."); result.Result.Should().BeSameAs(_serverResult); }
public void constructor_should_initialize_subject_when_result_contains_code_and_codeName() { var serverResult = BsonDocument.Parse("{ ok : 0, code : 1234, codeName : 'some name' }"); var result = new MongoNodeIsRecoveringException(_connectionId, serverResult); result.ConnectionId.Should().BeSameAs(_connectionId); result.InnerException.Should().BeNull(); result.Message.Should().Be("Server returned node is recovering error (code = 1234, codeName = \"some name\")."); result.Result.Should().BeSameAs(serverResult); }
public void constructor_should_initialize_subject_when_result_contains_code(int code, bool isShutdownException) { var serverResult = BsonDocument.Parse($"{{ ok : 0, code : {code} }}"); var result = new MongoNodeIsRecoveringException(_connectionId, _command, serverResult); result.ConnectionId.Should().BeSameAs(_connectionId); result.InnerException.Should().BeNull(); result.Message.Should().Be($"Server returned node is recovering error (code = {code})."); result.Command.Should().BeSameAs(_command); result.Result.Should().BeSameAs(serverResult); result.IsShutdownError.Should().Be(isShutdownException); }
public void Serialization_should_work() { var subject = new MongoNodeIsRecoveringException(_connectionId, _serverResult); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (MongoNodeIsRecoveringException)formatter.Deserialize(stream); rehydrated.ConnectionId.Should().Be(subject.ConnectionId); rehydrated.InnerException.Should().BeNull(); rehydrated.Message.Should().Be(subject.Message); rehydrated.Result.Should().Be(subject.Result); } }
public void Serialization_should_work() { var subject = new MongoNodeIsRecoveringException(_connectionId, _serverResult); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (MongoNodeIsRecoveringException)formatter.Deserialize(stream); rehydrated.ConnectionId.Should().Be(subject.ConnectionId); rehydrated.InnerException.Should().BeNull(); rehydrated.Message.Should().Be(subject.Message); rehydrated.Result.Should().Be(subject.Result); } }