public void Constructor_should_work() { var processedRequests = new WriteRequest[0]; var upserts = new BulkWriteUpsert[0]; var result = new AcknowledgedBulkWriteOperationResult(1, 2, 3, 4, 5, processedRequests, upserts); var writeErrors = new BulkWriteError[0]; var writeConcernError = new WriteConcernError(1, "message", new BsonDocument("x", 1)); var unprocessedRequests = new WriteRequest[0]; var subject = new BulkWriteOperationException(result, writeErrors, writeConcernError, unprocessedRequests); subject.Result.Should().BeSameAs(result); subject.UnprocessedRequests.Should().BeSameAs(unprocessedRequests); subject.WriteConcernError.Should().BeSameAs(writeConcernError); subject.WriteErrors.Should().BeSameAs(writeErrors); }
public void Constructor_should_work() { var processedRequests = new WriteRequest[0]; var upserts = new BulkWriteUpsert[0]; var result = new AcknowledgedBulkWriteOperationResult(1, 2, 3, 4, 5, processedRequests, upserts); var writeErrors = new BulkWriteError[0]; var writeConcernError = new WriteConcernError(1, "message", new BsonDocument("x", 1)); var unprocessedRequests = new WriteRequest[0]; var subject = new BulkWriteOperationException(result, writeErrors, writeConcernError, unprocessedRequests); subject.Result.Should().BeSameAs(result); subject.UnprocessedRequests.Should().BeSameAs(unprocessedRequests); subject.WriteConcernError.Should().BeSameAs(writeConcernError); subject.WriteErrors.Should().BeSameAs(writeErrors); }
public void Serialization_should_drop_custom_fields() { var processedRequests = new WriteRequest[0]; var upserts = new BulkWriteUpsert[0]; var result = new AcknowledgedBulkWriteOperationResult(1, 2, 3, 4, 5, processedRequests, upserts); var writeErrors = new BulkWriteError[0]; var writeConcernError = new WriteConcernError(1, "message", new BsonDocument("x", 1)); var unprocessedRequests = new WriteRequest[0]; var subject = new BulkWriteOperationException(result, writeErrors, writeConcernError, unprocessedRequests); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (BulkWriteOperationException)formatter.Deserialize(stream); rehydrated.Result.Should().BeNull(); rehydrated.UnprocessedRequests.Should().BeNull(); rehydrated.WriteConcernError.Should().BeNull(); rehydrated.WriteErrors.Should().BeNull(); } }
public void Serialization_should_drop_custom_fields() { var processedRequests = new WriteRequest[0]; var upserts = new BulkWriteUpsert[0]; var result = new AcknowledgedBulkWriteOperationResult(1, 2, 3, 4, 5, processedRequests, upserts); var writeErrors = new BulkWriteError[0]; var writeConcernError = new WriteConcernError(1, "message", new BsonDocument("x", 1)); var unprocessedRequests = new WriteRequest[0]; var subject = new BulkWriteOperationException(result, writeErrors, writeConcernError, unprocessedRequests); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, subject); stream.Position = 0; var rehydrated = (BulkWriteOperationException)formatter.Deserialize(stream); rehydrated.Result.Should().BeNull(); rehydrated.UnprocessedRequests.Should().BeNull(); rehydrated.WriteConcernError.Should().BeNull(); rehydrated.WriteErrors.Should().BeNull(); } }