13
13
* limitations under the License.
14
14
*/
15
15
16
- using System ;
17
16
using MongoDB . Bson ;
18
17
using MongoDB . Driver ;
19
18
using NUnit . Framework ;
@@ -23,14 +22,6 @@ namespace MongoDB.DriverUnitTests.Exceptions
23
22
[ TestFixture ]
24
23
public class ExceptionMapperTests
25
24
{
26
- private MongoServerInstance _primary ;
27
-
28
- [ TestFixtureSetUp ]
29
- public void Setup ( )
30
- {
31
- _primary = Configuration . TestServer . Primary ;
32
- }
33
-
34
25
[ Test ]
35
26
public void TestDoesNotThrowExceptionWhenEverythingIsKosherWithAWriteConcernResult ( )
36
27
{
@@ -42,7 +33,6 @@ public void TestDoesNotThrowExceptionWhenEverythingIsKosherWithAWriteConcernResu
42
33
} ;
43
34
44
35
var writeConcernResult = new WriteConcernResult ( response ) ;
45
- writeConcernResult . ServerInstance = _primary ;
46
36
var ex = ExceptionMapper . Map ( writeConcernResult ) ;
47
37
48
38
Assert . IsNull ( ex ) ;
@@ -74,7 +64,6 @@ public void TestThrowsDuplicateKeyExceptionForMongod(int code)
74
64
} ;
75
65
76
66
var writeConcernResult = new WriteConcernResult ( response ) ;
77
- writeConcernResult . ServerInstance = _primary ;
78
67
var ex = ExceptionMapper . Map ( writeConcernResult ) ;
79
68
80
69
Assert . IsNotNull ( ex ) ;
@@ -109,7 +98,6 @@ public void TestThrowsDuplicateKeyExceptionForMongos(int code)
109
98
} ;
110
99
111
100
var writeConcernResult = new WriteConcernResult ( response ) ;
112
- writeConcernResult . ServerInstance = _primary ;
113
101
var ex = ExceptionMapper . Map ( writeConcernResult ) ;
114
102
115
103
Assert . IsNotNull ( ex ) ;
@@ -129,7 +117,6 @@ public void TestThrowsWriteConcernExceptionWhenNotOk()
129
117
} ;
130
118
131
119
var writeConcernResult = new WriteConcernResult ( response ) ;
132
- writeConcernResult . ServerInstance = _primary ;
133
120
var ex = ExceptionMapper . Map ( writeConcernResult ) ;
134
121
135
122
Assert . IsNotNull ( ex ) ;
@@ -149,69 +136,12 @@ public void TestThrowsWriteConcernExceptionWhenOkButHasLastErrorMessage()
149
136
} ;
150
137
151
138
var writeConcernResult = new WriteConcernResult ( response ) ;
152
- writeConcernResult . ServerInstance = _primary ;
153
139
var ex = ExceptionMapper . Map ( writeConcernResult ) ;
154
140
155
141
Assert . IsNotNull ( ex ) ;
156
142
Assert . IsInstanceOf < WriteConcernException > ( ex ) ;
157
143
}
158
144
159
- [ Test ]
160
- public void TestThrowsWriteConcernExceptionWhenOkButHasWNoteOnPre26Servers ( )
161
- {
162
- var response = new BsonDocument
163
- {
164
- { "err" , BsonNull . Value } ,
165
- { "code" , 20 } ,
166
- { "n" , 0 } ,
167
- { "connectionId" , 1 } ,
168
- { "ok" , 1 } ,
169
- { "wnote" , "oops" }
170
- } ;
171
-
172
- var writeConcernResult = new WriteConcernResult ( response ) ;
173
- writeConcernResult . ServerInstance = _primary ;
174
- var ex = ExceptionMapper . Map ( writeConcernResult ) ;
175
-
176
- if ( _primary . BuildInfo . Version < new Version ( 2 , 6 , 0 ) )
177
- {
178
- Assert . IsNull ( ex ) ;
179
- }
180
- else
181
- {
182
- Assert . IsNotNull ( ex ) ;
183
- Assert . IsInstanceOf < WriteConcernException > ( ex ) ;
184
- }
185
- }
186
-
187
- [ Test ]
188
- public void TestThrowsWriteConcernExceptionWhenOkButHasJNoteOnPre26Servers ( )
189
- {
190
- var response = new BsonDocument
191
- {
192
- { "err" , BsonNull . Value } ,
193
- { "code" , 20 } ,
194
- { "n" , 0 } ,
195
- { "connectionId" , 1 } ,
196
- { "ok" , 1 } ,
197
- { "jnote" , "oops" }
198
- } ;
199
-
200
- var writeConcernResult = new WriteConcernResult ( response ) ;
201
- writeConcernResult . ServerInstance = _primary ;
202
- var ex = ExceptionMapper . Map ( writeConcernResult ) ;
203
-
204
- if ( _primary . BuildInfo . Version < new Version ( 2 , 6 , 0 ) )
205
- {
206
- Assert . IsNull ( ex ) ;
207
- }
208
- else
209
- {
210
- Assert . IsNotNull ( ex ) ;
211
- Assert . IsInstanceOf < WriteConcernException > ( ex ) ;
212
- }
213
- }
214
-
215
145
[ Test ]
216
146
[ TestCase ( 50 ) ]
217
147
[ TestCase ( 13475 ) ]
0 commit comments