@@ -25,27 +25,27 @@ namespace MongoDB.Driver.Core.Operations
25
25
[ TestFixture ]
26
26
public class FindOneAndReplaceOperationTests : OperationTestBase
27
27
{
28
- private BsonDocument _criteria ;
28
+ private BsonDocument _filter ;
29
29
private BsonDocument _replacement ;
30
30
31
31
public override void TestFixtureSetUp ( )
32
32
{
33
33
base . TestFixtureSetUp ( ) ;
34
34
35
- _criteria = new BsonDocument ( "x" , 1 ) ;
35
+ _filter = new BsonDocument ( "x" , 1 ) ;
36
36
_replacement = BsonDocument . Parse ( "{_id: 10, a: 2}" ) ;
37
37
}
38
38
39
39
[ Test ]
40
40
public void Constructor_should_throw_when_collection_namespace_is_null ( )
41
41
{
42
- Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( null , _criteria , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
42
+ Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( null , _filter , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
43
43
44
44
act . ShouldThrow < ArgumentNullException > ( ) ;
45
45
}
46
46
47
47
[ Test ]
48
- public void Constructor_should_throw_when_criteria_is_null ( )
48
+ public void Constructor_should_throw_when_filter_is_null ( )
49
49
{
50
50
Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , null , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
51
51
@@ -55,34 +55,34 @@ public void Constructor_should_throw_when_criteria_is_null()
55
55
[ Test ]
56
56
public void Constructor_should_throw_when_replacement_is_null ( )
57
57
{
58
- Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _criteria , null , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
58
+ Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _filter , null , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
59
59
60
60
act . ShouldThrow < ArgumentNullException > ( ) ;
61
61
}
62
62
63
63
[ Test ]
64
64
public void Constructor_should_throw_when_result_serializer_is_null ( )
65
65
{
66
- Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _criteria , _replacement , null , _messageEncoderSettings ) ;
66
+ Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _filter , _replacement , null , _messageEncoderSettings ) ;
67
67
68
68
act . ShouldThrow < ArgumentNullException > ( ) ;
69
69
}
70
70
71
71
[ Test ]
72
72
public void Constructor_should_throw_when_message_encoder_settings_is_null ( )
73
73
{
74
- Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _criteria , _replacement , BsonDocumentSerializer . Instance , null ) ;
74
+ Action act = ( ) => new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _filter , _replacement , BsonDocumentSerializer . Instance , null ) ;
75
75
76
76
act . ShouldThrow < ArgumentNullException > ( ) ;
77
77
}
78
78
79
79
[ Test ]
80
80
public void Constructor_should_initialize_object ( )
81
81
{
82
- var subject = new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _criteria , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
82
+ var subject = new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _filter , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings ) ;
83
83
84
84
subject . CollectionNamespace . Should ( ) . Be ( _collectionNamespace ) ;
85
- subject . Criteria . Should ( ) . Be ( _criteria ) ;
85
+ subject . Filter . Should ( ) . Be ( _filter ) ;
86
86
subject . Replacement . Should ( ) . Be ( _replacement ) ;
87
87
subject . ResultSerializer . Should ( ) . NotBeNull ( ) ;
88
88
subject . MessageEncoderSettings . Should ( ) . BeEquivalentTo ( _messageEncoderSettings ) ;
@@ -98,7 +98,7 @@ public void CreateCommand_should_create_the_correct_command(
98
98
{
99
99
var projectionDoc = projection == null ? ( BsonDocument ) null : BsonDocument . Parse ( projection ) ;
100
100
var sortDoc = sort == null ? ( BsonDocument ) null : BsonDocument . Parse ( sort ) ;
101
- var subject = new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _criteria , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings )
101
+ var subject = new FindOneAndReplaceOperation < BsonDocument > ( _collectionNamespace , _filter , _replacement , BsonDocumentSerializer . Instance , _messageEncoderSettings )
102
102
{
103
103
IsUpsert = isUpsert ,
104
104
MaxTime = maxTimeMS . HasValue ? TimeSpan . FromMilliseconds ( maxTimeMS . Value ) : ( TimeSpan ? ) null ,
@@ -110,7 +110,7 @@ public void CreateCommand_should_create_the_correct_command(
110
110
var expectedResult = new BsonDocument
111
111
{
112
112
{ "findAndModify" , _collectionNamespace . CollectionName } ,
113
- { "query" , _criteria } ,
113
+ { "query" , _filter } ,
114
114
{ "sort" , sortDoc , sortDoc != null } ,
115
115
{ "update" , _replacement , _replacement != null } ,
116
116
{ "new" , ! returnOriginal } ,
@@ -130,7 +130,7 @@ public async Task ExecuteAsync_against_an_existing_document_returning_the_origin
130
130
{
131
131
var subject = new FindOneAndReplaceOperation < BsonDocument > (
132
132
_collectionNamespace ,
133
- _criteria ,
133
+ _filter ,
134
134
_replacement ,
135
135
new FindAndModifyValueDeserializer < BsonDocument > ( BsonDocumentSerializer . Instance ) ,
136
136
_messageEncoderSettings )
@@ -153,7 +153,7 @@ public async Task ExecuteAsync_against_an_existing_document_returning_the_replac
153
153
{
154
154
var subject = new FindOneAndReplaceOperation < BsonDocument > (
155
155
_collectionNamespace ,
156
- _criteria ,
156
+ _filter ,
157
157
_replacement ,
158
158
new FindAndModifyValueDeserializer < BsonDocument > ( BsonDocumentSerializer . Instance ) ,
159
159
_messageEncoderSettings )
0 commit comments