Here are the examples of the csharp api class NUnit.Framework.Assert.AreEqual(int, int, string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
58 Examples
0
1. Example
View licensepublic void AreEqual_should_have_message_original_formated_message() { var expected = 1; var actual = 2; Assert.AreEqual(expected, actual, "{0}_{1}", "original", "message"); }
0
2. Example
View licensestatic public void AreEqual(int expected, int actual, string message) { Assert.AreEqual( expected, actual, message, null ); }
0
3. Example
View licensestatic public void AreEqual(int expected, int actual ) { Assert.AreEqual( expected, actual, string.Empty, null ); }
0
4. Example
View licensestatic public void AreEqual(int expected, int actual, string message) { Assert.AreEqual( expected, actual, message, null ); }
0
5. Example
View licensestatic public void AreEqual(int expected, int actual ) { Assert.AreEqual( expected, actual, string.Empty, null ); }
0
6. Example
View license[Test] public void TestEncodeRune () { var result = new byte [10]; Utf8.EncodeRune (0x10000, result); foreach (var rm in runeMap) { var n = Utf8.EncodeRune (rm.Rune, result); for (int i = 0; i < rm.Bytes.Length; i++) Assert.AreEqual (rm.Bytes [i], result [i], "Failure with rune {0} (0x{0:x}) at index {1}", rm.Rune, i); } }
0
7. Example
View license[Test] public void TestCalcTitleWidthZero () { MacroscopeAnalyzePageTitles AnalyzePageTitles = new MacroscopeAnalyzePageTitles (); int Width = AnalyzePageTitles.CalcTitleWidth( "" ); Assert.AreEqual( Width, 0, "Width not equal to zero", 1 ); }
0
8. Example
View licensepublic void Assert() { NUnit.Framework.Assert.AreEqual ( m_expectedRaiseCount, m_actualRaiseCount, "{0} expected raised {1} times, but was {2}", m_eventName, m_expectedRaiseCount, m_actualRaiseCount); }
0
9. Example
View licensepublic void VerifyAll() { Assert.AreEqual(expectedCallbacks.Count, nextCallback, "Expected {0} callbacks, but got only {1}.", expectedCallbacks.Count, nextCallback); }
0
10. Example
View licensepublic static void AssertBuffersEqual(byte[] expected, byte[] actual) { for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i], "Buffers differed at index {0}", i); } }
0
11. Example
View licenseprivate static void ValidateBuffer(byte[] buffer) { Assert.AreEqual(8192, buffer.Length); for(int i = 0; i < buffer.Length;i++) { Assert.AreEqual(TestBuffer[i], buffer[i], "Mismatch in buffer at index {0}", i); } }
0
12. Example
View licensepublic static void AssertHasVertices(this Model3D model, params double[][] vertices) { var geometryModel = (GeometryModel3D) model; var geometry = (MeshGeometry3D) geometryModel.Geometry; Assert.AreEqual(vertices.Length, geometry.Positions.Count, "Expected to find {0} vertices in model", vertices.Length); foreach (var vertex in vertices) Assert.IsTrue(geometry.Positions.Contains(new Point3D(vertex[0], vertex[1], vertex[2])), "Expected geometry to contain vertex [{0},{1},{2}]", vertex[0],vertex[1],vertex[2]); }
0
13. Example
View licensepublic static void AssertContains(this PointCollection collection, params double[][] points) { Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length); foreach (var point in points) Assert.IsTrue(collection.Contains(new Point(point[0],point[1])), "Expected collection to contain point [{0},{1}]", point[0], point[1]); }
0
14. Example
View licensepublic static void AssertContains(this Vector3DCollection collection, params double[][] points) { Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length); foreach (var point in points) Assert.IsTrue(collection.Contains(new Vector3D(point[0],point[1],point[2])), "Expected collection to contain point [{0},{1},{2}]", point[0], point[1], point[2]); }
0
15. Example
View licensepublic static void AssertContains(this Point3DCollection collection, params double[][] points) { Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length); foreach (var point in points) Assert.IsTrue(collection.Contains(new Point3D(point[0],point[1],point[2])), "Expected collection to contain point [{0},{1},{2}]", point[0], point[1], point[2]); }
0
16. Example
View license[Test] public void TestCharsetUtilsGetCodePage () { for (int i = 1; i < 16; i++) { int/n ..... /n //View Source file for more details /n }
0
17. Example
View license[Test] public void TestUpdatePartial() { var updates = DB["updates"]; var coolness = 5; var einstein = new Document {{"Last", "Einstien"}, {"First", "Albert"}, {"Coolness", coolness++}}; updates.Insert(einstein); var selector = new Document {{"_id", einstein["_id"]}}; updates.Update(new Document {{"$inc", new Document {{"Coolness", 1}}}}, selector); Assert.AreEqual(coolness++, Convert.ToInt32(updates.FindOne(selector)["Coolness"]), "Coolness field not incremented", true); updates.Update(new Document { {"$set", new Document {{"Last", "Einstein"}}}, {"$inc", new Document {{"Coolness", 1}}} }, selector, true); Assert.AreEqual(coolness++, Convert.ToInt32(updates.FindOne(selector)["Coolness"]), "Coolness field not incremented"); }
0
18. Example
View license[Test] public void TestUpdatePartial(){ var updates = DB.GetCollection<CountsEntity>("updates"); var coolness = 5; var einstein = new CountsEntity {Last = "Einstein", First = "Albret", Coolness = coolness++}; updates.Insert(einstein); var selector = new {Last = "Einstein"}; updates.Update(new Document {{"$inc", new Document("cnt", 1)}}, selector); Assert.AreEqual(coolness++, Convert.ToInt32(updates.FindOne(selector).Coolness), "Coolness field not incremented", true); updates.Update(new Document { {"$set", new {First = "Albert"}}, {"$inc", new Document {{"cnt", 1}}} }, selector, true); Assert.AreEqual(coolness++, Convert.ToInt32(updates.FindOne(selector).Coolness), "Coolness field not incremented"); }
0
19. Example
View licenseprivate static void ValidateSearch(BPlusTree tree, int keyCount, string pageStoreName) { var value = new byte[64]; for (int key = 0; key < keyCount; key++) { Assert.IsTrue(tree.Search((ulong) key, value, null), "Could not find entry for key {0} in store {1}", key, pageStoreName); Assert.AreEqual(key, BitConverter.ToInt32(value, 0), "Incorrect value found for key {0} in store {1}", key, pageStoreName); } }
0
20. Example
View license[Test] public void TestWrite () { var buffer = new byte[(int) chained.Length]; for (int i = 0; i < buffer.Length; i++) buffer[i] = (byte) (i & 0xff); chained.Position = 0; chained.Write (buffer, 0, buffer.Length); chained.Flush (); var array = backing.ToArray (); for (int i = 0; i < buffer.Length; i++) Assert.AreEqual (buffer[i], array[i], "Written byte @ offset {0} did not match", i); }
0
21. Example
View license[Test] public async void TestWriteAsync () { var buffer = new byte[(int) chained.Length]; for (int i = 0; i < buffer.Length; i++) buffer[i] = (byte) (i & 0xff); chained.Position = 0; await chained.WriteAsync (buffer, 0, buffer.Length); await chained.FlushAsync (); var array = backing.ToArray (); for (int i = 0; i < buffer.Length; i++) Assert.AreEqual (buffer[i], array[i], "Written byte @ offset {0} did not match", i); }
0
22. Example
View licensepublic void TestSequence (ustring s) { var index = new(int idx, uint rune) [s.Length]; var si = 0; var j = 0; foreach ((var i, var rune) in s.Range ()) { Assert.AreEqual (i, si, "Sequence mismatch at index {0} = {1}", i, si); index [j] = (i, rune); j++; (var r1, var size1) = Utf8.DecodeRune (Subset (s.ToByteArray (), i, -1)); Assert.AreEqual (rune, r1, "DecodeRune 0x{0:x} = want 0x{1:x} with {2}", r1, rune, s); (var r2, var size2) = Utf8.DecodeRune (s [i, 0]); Assert.AreEqual (size1, size2); si += size1; } j--; for (si = s.Length; si > 0;) { (var r1, var size1) = Utf8.DecodeLastRune (Subset (s.ToByteArray (), 0, si)); (var r2, var size2) = Utf8.DecodeLastRune (ustring.Make (Subset (s.ToByteArray (), 0, si))); (var r3, var size3) = Utf8.DecodeLastRune (s [0, si]); Assert.AreEqual (size1, size2); Assert.AreEqual (size1, size3); Assert.AreEqual (r1, index [j].rune); Assert.AreEqual (r2, index [j].rune); Assert.AreEqual (r3, index [j].rune); si -= size1; Assert.AreEqual (si, index [j].idx); j--; } Assert.AreEqual (si, 0, "DecodeLastRune finished at {0} not 0", si); }
0
23. Example
View licenseprotected void AssertSingle(TaskId task, string messageType) { var messages = (from m in messageElements where m.Name == messageType && task.MatchesTaskElement(m) select m.Name.ToString()).ToList(); Assert.AreEqual(1, messages.Count, "Expected one item of {0} for task {1}", messageType, task); }
0
24. Example
View licensestatic void AssertState (object encoder, object clone) { foreach (var field in encoder.GetType ().GetFields (BindingFlags.NonPublic | BindingFlags.Instance)) { var expected = field.GetValue (encoder); var actual = field.GetValue (clone); if (expected.GetType () == typeof (Crc32)) { var crc0 = (Crc32) expected; var crc1 = (Crc32) actual; Assert.AreEqual (crc0.Checksum, crc1.Checksum, "The cloned {0}.{1} does not match.", encoder.GetType ().Name, field.Name); } else { Assert.AreEqual (expected, actual, "The cloned {0}.{1} does not match.", encoder.GetType ().Name, field.Name); } } }
0
25. Example
View licensevoid AssertSeekResults (string operation) { int n = (int) Math.Min (master.Length - master.Position, mbuf.Length); int nread = chained.Read (cbuf, 0, n); int mread = master.Read (mbuf, 0, n); Assert.AreEqual (mread, nread, "Did not read the expected number of bytes from the chained stream after {0}", operation); Assert.AreEqual (master.Position, chained.Position, "The chained stream's position did not match after {0}", operation); for (int i = 0; i < n; i++) Assert.AreEqual (mbuf[i], cbuf[i], "The bytes read do not match after {0}", operation); }
0
26. Example
View licenseasync Task AssertSeekResultsAsync (string operation) { int n = (int) Math.Min (master.Length - master.Position, mbuf.Length); int nread = await chained.ReadAsync (cbuf, 0, n); int mread = await master.ReadAsync (mbuf, 0, n); Assert.AreEqual (mread, nread, "Did not read the expected number of bytes from the chained stream after {0}", operation); Assert.AreEqual (master.Position, chained.Position, "The chained stream's position did not match after {0}", operation); for (int i = 0; i < n; i++) Assert.AreEqual (mbuf[i], cbuf[i], "The bytes read do not match after {0}", operation); }
0
27. Example
View licenseprivate static void ValidateSenseControls(object iView, bool isSubsense) { var label = isSubsen/n ..... /n //View Source file for more details /n }
0
28. Example
View licenseprivate static void ValidateScan(IEnumerable<KeyValuePair<byte [], byte []>> scan, int keyCount, string pageStoreName) { int ix = 0; foreach (var keyValuePair in scan) { Assert.AreEqual((ulong) ix, BitConverter.ToUInt64(keyValuePair.Key, 0), "Unexpected key at index {0} in test store {1}", ix, pageStoreName); Assert.AreEqual(ix, BitConverter.ToInt32(keyValuePair.Value, 0), "Unexpected value at index {0} in test store {1}", ix, pageStoreName); ix++; Assert.IsTrue(ix <= keyCount, "Scan returned more entries than expected in test store {0}", pageStoreName); } Assert.AreEqual(keyCount, ix, "Scan returned unexpected number of entries in test store {0}",pageStoreName); }
0
29. Example
View licensestatic void AssertInternetAddressListsEqual (string text, InternetAddressList expected, InternetAddressList result) { Assert.AreEqual (expected.Count, result.Count, "Unexpected number of addresses: {0}", text); for (int i = 0; i < expected.Count; i++) { Assert.AreEqual (expected.GetType (), result.GetType (), "Address #{0} differs in type: {1}", i, text); Assert.AreEqual (expected[i].ToString (), result[i].ToString (), "Display strings differ for {0}", text); } var encoded = result.ToString (true).Replace ("\r\n", "\n"); Assert.AreEqual (text, encoded, "Encoded strings differ for {0}", text); }
0
30. Example
View licenseprotected int GetMessageIndex(TaskId task, string messageType) { var indices = (messageElements.Select((e, i) => new {Element = e, Index = i}) .Where(x => x.Element.Name == messageType && task.MatchesTaskElement(x.Element)) .Select(x => x.Index)).ToList(); Assert.AreEqual(1, indices.Count, "Expected single message of type {0} for task {1}", messageType, task); return indices.Single(); }
0
31. Example
View licensepublic virtual void TestBatchedInserts() { var sid = "TestBatchedInserts_" + Dat/n ..... /n //View Source file for more details /n }
0
32. Example
View licensepublic virtual void TestBatchedInsertsRepeatable() { var sid = "TestBatchedInser/n ..... /n //View Source file for more details /n }
0
33. Example
View license[Test] public void TestUUDecode () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (original, 4096); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.uu")) { using (var filtered = new FilteredStream (file)) { filtered.Add (DecoderFilter.Create (ContentEncoding.UUEncode)); filtered.CopyTo (decoded, 4096); } } var buf0 = original.GetBuffer (); var buf1 = decoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, decoded.Length, "Decoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
34. Example
View license[Test] public void TestRead () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (original, 4096); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.b64")) { using (var filtered = new FilteredStream (file)) { filtered.Add (DecoderFilter.Create (ContentEncoding.Base64)); filtered.CopyTo (decoded, 4096); } } var buf0 = original.GetBuffer (); var buf1 = decoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, decoded.Length, "Decoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
35. Example
View license[Test] public async void TestReadAsync () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (original, 4096); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.b64")) { using (var filtered = new FilteredStream (file)) { filtered.Add (DecoderFilter.Create (ContentEncoding.Base64)); await filtered.CopyToAsync (decoded, 4096); } } var buf0 = original.GetBuffer (); var buf1 = decoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, decoded.Length, "Decoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
36. Example
View license[Test] public void TestBase64Encode () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.b64")) { using (var filtered = new FilteredStream (original)) { filtered.Add (new Dos2UnixFilter ()); file.CopyTo (filtered, 4096); filtered.Flush (); } } using (var encoded = new MemoryStream ()) { using (var filtered = new FilteredStream (encoded)) { filtered.Add (EncoderFilter.Create (ContentEncoding.Base64)); using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (filtered, 4096); filtered.Flush (); } var buf0 = original.GetBuffer (); var buf1 = encoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, encoded.Length, "Encoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
37. Example
View license[Test] public void TestYDecodeMultiPart () { var expected = File.ReadAllBytes ("../../TestData/yenc/joystick.jpg"); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/yenc/00000020.ntx")) { var ydec = new YDecoder (); using (var filtered = new FilteredStream (decoded)) { filtered.Add (new DecoderFilter (ydec)); file.CopyTo (filtered, 1); filtered.Flush (); } Assert.AreEqual (11250, decoded.Length, "The decoded size does not match (part 1)."); Assert.AreEqual (0xbfae5c0b, ydec.Checksum ^ 0xffffffff, "The decoded checksum does not match (part 1)."); } using (var file = File.OpenRead ("../../TestData/yenc/00000021.ntx")) { var ydec = new YDecoder (); using (var filtered = new FilteredStream (decoded)) { filtered.Add (new DecoderFilter (ydec)); file.CopyTo (filtered, 1); filtered.Flush (); } Assert.AreEqual (19338, decoded.Length, "The decoded size does not match (part 2)."); Assert.AreEqual (0xaca76043, ydec.Checksum ^ 0xffffffff, "The decoded checksum does not match (part 2)."); } var actual = decoded.GetBuffer (); for (int i = 0; i < expected.Length; i++) Assert.AreEqual (expected[i], actual[i], "different content at index {0}", i); } }
0
38. Example
View license[Test] public void TestWrite () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (original, 4096); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.b64")) { using (var filtered = new FilteredStream (decoded)) { filtered.Add (DecoderFilter.Create (ContentEncoding.Base64)); file.CopyTo (filtered, 4096); filtered.Flush (); } } var buf0 = original.GetBuffer (); var buf1 = decoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, decoded.Length, "Decoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
39. Example
View license[Test] public void TestTranscoding () { var path = Path.Combine ("..", "..", "TestData", "images", "girl.jpg"); var expected = File.ReadAllBytes (path); var part = new MimePart ("image", "jpeg") { ContentObject = new ContentObject (new MemoryStream (expected, false)), ContentTransferEncoding = ContentEncoding.Base64, FileName = "girl.jpg" }; // encode in base64 using (var output = new MemoryStream ()) { part.WriteTo (output); output.Position = 0; part = (MimePart) MimeEntity.Load (output); } // transcode to uuencode part.ContentTransferEncoding = ContentEncoding.UUEncode; using (var output = new MemoryStream ()) { part.WriteTo (output); output.Position = 0; part = (MimePart) MimeEntity.Load (output); } // verify decoded content using (var output = new MemoryStream ()) { part.ContentObject.DecodeTo (output); output.Position = 0; var actual = output.ToArray (); Assert.AreEqual (expected.Length, actual.Length); for (int i = 0; i < expected.Length; i++) Assert.AreEqual (expected[i], actual[i], "Image content differs at index {0}", i); } }
0
40. Example
View license[Test] public async void TestTranscodingAsync () { var path = Path.Combine ("..", "..", "TestData", "images", "girl.jpg"); var expected = File.ReadAllBytes (path); var part = new MimePart ("image", "jpeg") { ContentObject = new ContentObject (new MemoryStream (expected, false)), ContentTransferEncoding = ContentEncoding.Base64, FileName = "girl.jpg" }; // encode in base64 using (var output = new MemoryStream ()) { await part.WriteToAsync (output); output.Position = 0; part = (MimePart) await MimeEntity.LoadAsync (output); } // transcode to uuencode part.ContentTransferEncoding = ContentEncoding.UUEncode; using (var output = new MemoryStream ()) { await part.WriteToAsync (output); output.Position = 0; part = (MimePart) await MimeEntity.LoadAsync (output); } // verify decoded content using (var output = new MemoryStream ()) { await part.ContentObject.DecodeToAsync (output); output.Position = 0; var actual = output.ToArray (); Assert.AreEqual (expected.Length, actual.Length); for (int i = 0; i < expected.Length; i++) Assert.AreEqual (expected[i], actual[i], "Image content differs at index {0}", i); } }
0
41. Example
View license[Test] public void NonNullNSStringFields () { Errors = 0; int c = 0, n = 0; foreach (Type t in Assembly.GetTypes ()) { if (Skip (t) || SkipDueToAttribute (t)) continue; if (LogProgress) Console.WriteLine ("{0}. {1}", c++, t.FullName); foreach (var p in t.GetProperties (BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { // looking for properties with getters only if (p.CanWrite || !p.CanRead) continue; // FIXME: testing NSString only (vast majority but there are others) if (p.PropertyType.FullName != NSStringType) continue; string name; bool result = CheckAgainstNull (p, out name); if (!ContinueOnFailure) Assert.IsTrue (result, name); else if (!result) { Console.WriteLine ("[FAIL] {0}", name); Errors++; } n++; } } Assert.AreEqual (0, Errors, "{0} errors found in {1} fields validated", Errors, n); }
0
42. Example
View license[Test] public void Signatures () { int n = 0; Errors = 0; foreach (Type t in Assembly.GetTypes ()) { if (t.IsNested || !NSObjectType.IsAssignableFrom (t)) continue; if (Skip (t)) continue; CurrentType = t; FieldInfo fi = t.GetField ("class_ptr", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); if (fi == null) continue; // e.g. *Delegate IntPtr class_ptr = (IntPtr) fi.GetValue (null); foreach (MethodBase m in t.GetMethods (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)) CheckMemberSignature (m, t, class_ptr, ref n); foreach (MethodBase m in t.GetConstructors (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)) CheckMemberSignature (m, t, class_ptr, ref n); } Assert.AreEqual (0, Errors, "{0} errors found in {1} signatures validated", Errors, n); }
0
43. Example
View licenseprotected void AssertContainsFinish(TaskId task, string expectedTaskResult, string expectedMessage = null) { var messages = (from e in messageElements where e.Name == TaskAction.Finish && task.MatchesTaskElement(e) select new { Result = e.Attribute("result").Value, Message = GetElementValue(e, "message") }).ToList(); Assert.AreEqual(1, messages.Count, "Expected single message of type {0} for task {1}", TaskAction.Finish, task); var result = messages.Single(); Assert.AreEqual(expectedTaskResult, result.Result); if (!string.IsNullOrEmpty(expectedMessage)) Assert.AreEqual(expectedMessage, result.Message); }
0
44. Example
View license[Test] [Category("Tar")] public void BlockFactorHandling() { const int MinimumBlockFactor =/n ..... /n //View Source file for more details /n }
0
45. Example
View license[Test] [Category("Tar")] public void BlockFactorHandling() { const int MinimumB/n ..... /n //View Source file for more details /n }
0
46. Example
View license[Test] public async void TestWriteAsync () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (original, 4096); using (var decoded = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.b64")) { using (var filtered = new FilteredStream (decoded)) { filtered.Add (DecoderFilter.Create (ContentEncoding.Base64)); await file.CopyToAsync (filtered, 4096); await filtered.FlushAsync (); } } var buf0 = original.GetBuffer (); var buf1 = decoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, decoded.Length, "Decoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
47. Example
View license[Test] public void New_TryEnqueueItem_x50_TryEnqueueConsumer_x50_ItemCount_ConsumerCount() {/n ..... /n //View Source file for more details /n }
0
48. Example
View license[Test] [Category("Tar")] public void BlockFactorHandling() { const int MinimumB/n ..... /n //View Source file for more details /n }
0
49. Example
View license[Test] public void TestUUEncode () { using (var original = new MemoryStream ()) { using (var file = File.OpenRead ("../../TestData/encoders/photo.uu")) { using (var filtered = new FilteredStream (original)) { filtered.Add (new Dos2UnixFilter ()); file.CopyTo (filtered, 4096); filtered.Flush (); } } using (var encoded = new MemoryStream ()) { var begin = Encoding.ASCII.GetBytes ("begin 644 photo.jpg\n"); var end = Encoding.ASCII.GetBytes ("end\n"); encoded.Write (begin, 0, begin.Length); using (var filtered = new FilteredStream (encoded)) { filtered.Add (EncoderFilter.Create (ContentEncoding.UUEncode)); using (var file = File.OpenRead ("../../TestData/encoders/photo.jpg")) file.CopyTo (filtered, 4096); filtered.Flush (); } encoded.Write (end, 0, end.Length); var buf0 = original.GetBuffer (); var buf1 = encoded.GetBuffer (); int n = (int) original.Length; Assert.AreEqual (original.Length, encoded.Length, "Encoded length is incorrect."); for (int i = 0; i < n; i++) Assert.AreEqual (buf0[i], buf1[i], "The byte at offset {0} does not match.", i); } } }
0
50. Example
View license[Test] public void DefaultCtorAllowed () { Errors = 0; int n = 0; foreach (Type t in Assembly.GetTypes ()) { if (t.IsAbstract || !NSObjectType.IsAssignableFrom (t)) continue; if (Skip (t) || SkipDueToAttribute (t)) continue; var ctor = t.GetConstructor (Type.EmptyTypes); if ((ctor == null) || ctor.IsAbstract) { if (LogUntestedTypes) Console.WriteLine ("[WARNING] {0} was skipped because it had no default constructor", t); continue; } instance_type_name = t.FullName; if (LogProgress) Console.WriteLine ("{0}. {1}", n, instance_type_name); NSObject obj = null; try { obj = ctor.Invoke (null) as NSObject; CheckHandle (obj); CheckToString (obj); Dispose (obj, t); } catch (TargetInvocationException tie) { // Objective-C exception thrown if (!ContinueOnFailure) throw; Console.WriteLine ("[FAIL] {0} : {1}", instance_type_name, tie.InnerException); Errors++; } n++; } Assert.AreEqual (0, Errors, "{0} potential errors found in {1} default ctor validated", Errors, n); }