~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit.Test/NGit.Util/TemporaryBufferTest.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
using System.IO;
46
46
using NGit.Junit;
47
47
using NGit.Util;
 
48
using NUnit.Framework;
48
49
using Sharpen;
49
50
 
50
51
namespace NGit.Util
123
124
                                        byte[] r = b.ToByteArray();
124
125
                                        NUnit.Framework.Assert.IsNotNull(r);
125
126
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
126
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
127
                                        for (int i = 0; i < test.Length; i ++)
 
128
                                                Assert.AreEqual (test[i], r[i]);;
127
129
                                }
128
130
                                {
129
131
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
131
133
                                        o.Close();
132
134
                                        byte[] r = o.ToByteArray();
133
135
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
134
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
136
                                        for (int i = 0; i < test.Length; i ++)
 
137
                                                Assert.AreEqual (test[i], r[i]);
135
138
                                }
136
139
                        }
137
140
                        finally
159
162
                                        byte[] r = b.ToByteArray();
160
163
                                        NUnit.Framework.Assert.IsNotNull(r);
161
164
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
162
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
165
                                        for (int i = 0; i < test.Length; i ++)
 
166
                                                Assert.AreEqual (test[i], r[i]);
163
167
                                }
164
168
                                {
165
169
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
167
171
                                        o.Close();
168
172
                                        byte[] r = o.ToByteArray();
169
173
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
170
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
174
                                        for (int i = 0; i < test.Length; i ++)
 
175
                                                Assert.AreEqual (test[i], r[i]);
171
176
                                }
172
177
                        }
173
178
                        finally
195
200
                                        byte[] r = b.ToByteArray();
196
201
                                        NUnit.Framework.Assert.IsNotNull(r);
197
202
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
198
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
203
                                        for (int i = 0; i < test.Length; i ++)
 
204
                                                Assert.AreEqual (test[i], r[i]);
199
205
                                }
200
206
                                {
201
207
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
203
209
                                        o.Close();
204
210
                                        byte[] r = o.ToByteArray();
205
211
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
206
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
212
                                        for (int i = 0; i < test.Length; i ++)
 
213
                                                Assert.AreEqual (test[i], r[i]);
207
214
                                }
208
215
                        }
209
216
                        finally
230
237
                                        byte[] r = b.ToByteArray();
231
238
                                        NUnit.Framework.Assert.IsNotNull(r);
232
239
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
233
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
240
                                        for (int i = 0; i < test.Length; i ++)
 
241
                                                Assert.AreEqual (test[i], r[i]);
234
242
                                }
235
243
                                {
236
244
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
238
246
                                        o.Close();
239
247
                                        byte[] r = o.ToByteArray();
240
248
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
241
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
249
                                        for (int i = 0; i < test.Length; i ++)
 
250
                                                Assert.AreEqual (test[i], r[i]);
242
251
                                }
243
252
                        }
244
253
                        finally
263
272
                                        byte[] r = b.ToByteArray();
264
273
                                        NUnit.Framework.Assert.IsNotNull(r);
265
274
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
266
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
275
                                        for (int i = 0; i < test.Length; i ++)
 
276
                                                Assert.AreEqual (test[i], r[i]);
267
277
                                }
268
278
                                {
269
279
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
271
281
                                        o.Close();
272
282
                                        byte[] r = o.ToByteArray();
273
283
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
274
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
284
                                        for (int i = 0; i < test.Length; i ++)
 
285
                                                Assert.AreEqual (test[i], r[i]);
275
286
                                }
276
287
                        }
277
288
                        finally
292
303
                        InputStream @in = b.OpenInputStream();
293
304
                        byte[] act = new byte[cnt];
294
305
                        IOUtil.ReadFully(@in, act, 0, cnt);
295
 
                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, act));
 
306
                        for (int i = 0; i < test.Length; i ++)
 
307
                                Assert.AreEqual (test[i], act[i]);
296
308
                }
297
309
 
298
310
                /// <exception cref="System.IO.IOException"></exception>
312
324
                                        byte[] r = b.ToByteArray();
313
325
                                        NUnit.Framework.Assert.IsNotNull(r);
314
326
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
315
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
327
                                        for (int i = 0; i < test.Length; i ++)
 
328
                                                Assert.AreEqual (test[i], r[i]);
316
329
                                }
317
330
                                {
318
331
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
320
333
                                        o.Close();
321
334
                                        byte[] r = o.ToByteArray();
322
335
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
323
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
336
                                        for (int i = 0; i < test.Length; i ++)
 
337
                                                Assert.AreEqual (test[i], r[i]);
324
338
                                }
325
339
                        }
326
340
                        finally
346
360
                                        byte[] r = b.ToByteArray();
347
361
                                        NUnit.Framework.Assert.IsNotNull(r);
348
362
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
349
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
363
                                        for (int i = 0; i < test.Length; i ++)
 
364
                                                Assert.AreEqual (test[i], r[i]);
350
365
                                }
351
366
                                {
352
367
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
354
369
                                        o.Close();
355
370
                                        byte[] r = o.ToByteArray();
356
371
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
357
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
372
                                        for (int i = 0; i < test.Length; i ++)
 
373
                                                Assert.AreEqual (test[i], r[i]);
358
374
                                }
359
375
                        }
360
376
                        finally
382
398
                                        byte[] r = b.ToByteArray();
383
399
                                        NUnit.Framework.Assert.IsNotNull(r);
384
400
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
385
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
401
                                        for (int i = 0; i < test.Length; i ++)
 
402
                                                Assert.AreEqual (test[i], r[i]);
386
403
                                }
387
404
                                {
388
405
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
390
407
                                        o.Close();
391
408
                                        byte[] r = o.ToByteArray();
392
409
                                        NUnit.Framework.Assert.AreEqual(test.Length, r.Length);
393
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(test, r));
 
410
                                        for (int i = 0; i < test.Length; i ++)
 
411
                                                Assert.AreEqual (test[i], r[i]);
394
412
                                }
395
413
                        }
396
414
                        finally
452
470
                                        byte[] r = b.ToByteArray();
453
471
                                        NUnit.Framework.Assert.IsNotNull(r);
454
472
                                        NUnit.Framework.Assert.AreEqual(expect.Length, r.Length);
455
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(expect, r));
 
473
                                        for (int i = 0; i < expect.Length; i ++)
 
474
                                                Assert.AreEqual (expect[i], r[i]);
456
475
                                }
457
476
                                {
458
477
                                        ByteArrayOutputStream o = new ByteArrayOutputStream();
460
479
                                        o.Close();
461
480
                                        byte[] r = o.ToByteArray();
462
481
                                        NUnit.Framework.Assert.AreEqual(expect.Length, r.Length);
463
 
                                        NUnit.Framework.Assert.IsTrue(Arrays.Equals(expect, r));
 
482
                                        for (int i = 0; i < expect.Length; i ++)
 
483
                                                Assert.AreEqual (expect[i], r[i]);
464
484
                                }
465
485
                        }
466
486
                        finally