In Test/System.IO:
[mono.git] / mcs / class / corlib / Test / System.IO / MemoryStreamTest.cs
index 14975ab9a559bd222251802c0361201a58f27fb4..88ad55cab9f50c9be11458b5f4a04a4728c4495f 100644 (file)
@@ -632,6 +632,14 @@ namespace MonoTests.System.IO
                        Assert.IsNotNull (ms.GetBuffer ());
                }
 
+               [Test] // bug #350860
+               public void ToArray_Empty ()
+               {
+                       MemoryStream ms = new MemoryStream (1);
+                       ms.Capacity = 0;
+                       ms.ToArray ();
+               }
+
                [Test] // bug #80205
                [Category ("NotWorking")]
                public void SerializeTest ()
@@ -712,6 +720,25 @@ namespace MonoTests.System.IO
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x00, 0x00, 0x0b };
+#if NET_2_0
+               class MyMemoryStream : MemoryStream {
+
+                       public bool DisposedCalled = false;
+
+                       protected override void Dispose(bool disposing)
+                       {
+                               DisposedCalled = true;
+                       }
+               }
+
+               [Test] // https://bugzilla.novell.com/show_bug.cgi?id=322672
+               public void BaseDisposeCalled ()
+               {
+                       MyMemoryStream ms = new MyMemoryStream ();
+                       Assert.IsFalse (ms.DisposedCalled, "Before");
+                       ms.Close ();
+                       Assert.IsTrue (ms.DisposedCalled, "After");
+               }
+#endif
        }
 }
-