-//\r
-// SoundPlayerTest.cs - NUnit Test Cases for System.Media.SoundPlayer\r
-//\r
-// Authors:\r
-// Gert Driesen (drieseng@users.sourceforge.net)\r
-//\r
-// (C) 2007 Gert Driesen\r
-// \r
-\r
-#if NET_2_0\r
-\r
-using System;\r
-using System.IO;\r
-using System.Media;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.Media\r
-{\r
- [TestFixture]\r
- public class SoundPlayerTest\r
- {\r
- private int stream_changed;\r
-\r
- [SetUp]\r
- public void SetUp ()\r
- {\r
- stream_changed = 0;\r
- }\r
-\r
- [Test] // ctor ()\r
- public void Constructor0 ()\r
- {\r
- SoundPlayer player = new SoundPlayer ();\r
- Assert.IsNull (player.Container, "#1");\r
- Assert.IsFalse (player.IsLoadCompleted, "#2");\r
- Assert.AreEqual (10000, player.LoadTimeout, "#3");\r
- Assert.IsNull (player.Site, "#4");\r
- Assert.IsNotNull (player.SoundLocation, "#5");\r
- Assert.AreEqual (string.Empty, player.SoundLocation, "#6");\r
- Assert.IsNull (player.Stream, "#7");\r
- Assert.IsNull (player.Tag, "#8");\r
- }\r
-\r
- [Test] // ctor (Stream)\r
- public void Constructor1 ()\r
- {\r
- MemoryStream ms = new MemoryStream ();\r
-\r
- SoundPlayer player = new SoundPlayer (ms);\r
- Assert.IsFalse (player.IsLoadCompleted, "#A1");\r
- Assert.IsNotNull (player.SoundLocation, "#A2");\r
- Assert.AreEqual (string.Empty, player.SoundLocation, "#A3");\r
- Assert.AreSame (ms, player.Stream, "#A4");\r
-\r
- player = new SoundPlayer ((Stream) null);\r
- Assert.IsFalse (player.IsLoadCompleted, "#B1");\r
- Assert.IsNotNull (player.SoundLocation, "#B2");\r
- Assert.AreEqual (string.Empty, player.SoundLocation, "#B3");\r
- Assert.IsNull (player.Stream, "#B4");\r
- }\r
-\r
- [Test] // ctor (string)\r
- public void Constructor2 ()\r
- {\r
- string location = "whatever";\r
-\r
- SoundPlayer player = new SoundPlayer (location);\r
- Assert.IsFalse (player.IsLoadCompleted, "#1");\r
- Assert.AreSame (location, player.SoundLocation, "#2");\r
- Assert.AreEqual ("whatever", player.SoundLocation, "#3");\r
- Assert.IsNull (player.Stream, "#4");\r
- }\r
-\r
- [Test]\r
- public void Stream ()\r
- {\r
- MemoryStream ms = new MemoryStream ();\r
-\r
- SoundPlayer player = new SoundPlayer ();\r
- player.StreamChanged += new EventHandler (StreamChangedCounter);\r
- player.Stream = ms;\r
- Assert.AreSame (ms, player.Stream, "#A1");\r
- Assert.IsFalse (player.IsLoadCompleted, "#A2");\r
- Assert.AreEqual (1, stream_changed, "#A3");\r
- player.Stream = ms;\r
- Assert.AreSame (ms, player.Stream, "#B1");\r
- Assert.IsFalse (player.IsLoadCompleted, "#B2");\r
- Assert.AreEqual (1, stream_changed, "#B3");\r
- player.Stream = null;\r
- Assert.IsNull (player.Stream, "#C1");\r
- Assert.IsFalse (player.IsLoadCompleted, "#C2");\r
- Assert.AreEqual (2, stream_changed, "#C3");\r
- player.Stream = null;\r
- Assert.IsNull (player.Stream, "#D1");\r
- Assert.IsFalse (player.IsLoadCompleted, "#D2");\r
- Assert.AreEqual (2, stream_changed, "#D3");\r
- }\r
-\r
- void StreamChangedCounter (object sender, EventArgs e)\r
- {\r
- stream_changed++;\r
- }\r
- }\r
-}\r
-\r
-#endif\r
+//
+// SoundPlayerTest.cs - NUnit Test Cases for System.Media.SoundPlayer
+//
+// Authors:
+// Gert Driesen (drieseng@users.sourceforge.net)
+//
+// (C) 2007 Gert Driesen
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+using System.Media;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Media
+{
+ [TestFixture]
+ public class SoundPlayerTest
+ {
+ private int stream_changed;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ stream_changed = 0;
+ }
+
+ [Test] // ctor ()
+ public void Constructor0 ()
+ {
+ SoundPlayer player = new SoundPlayer ();
+ Assert.IsNull (player.Container, "#1");
+ Assert.IsFalse (player.IsLoadCompleted, "#2");
+ Assert.AreEqual (10000, player.LoadTimeout, "#3");
+ Assert.IsNull (player.Site, "#4");
+ Assert.IsNotNull (player.SoundLocation, "#5");
+ Assert.AreEqual (string.Empty, player.SoundLocation, "#6");
+ Assert.IsNull (player.Stream, "#7");
+ Assert.IsNull (player.Tag, "#8");
+ }
+
+ [Test] // ctor (Stream)
+ public void Constructor1 ()
+ {
+ MemoryStream ms = new MemoryStream ();
+
+ SoundPlayer player = new SoundPlayer (ms);
+ Assert.IsFalse (player.IsLoadCompleted, "#A1");
+ Assert.IsNotNull (player.SoundLocation, "#A2");
+ Assert.AreEqual (string.Empty, player.SoundLocation, "#A3");
+ Assert.AreSame (ms, player.Stream, "#A4");
+
+ player = new SoundPlayer ((Stream) null);
+ Assert.IsFalse (player.IsLoadCompleted, "#B1");
+ Assert.IsNotNull (player.SoundLocation, "#B2");
+ Assert.AreEqual (string.Empty, player.SoundLocation, "#B3");
+ Assert.IsNull (player.Stream, "#B4");
+ }
+
+ [Test] // ctor (string)
+ public void Constructor2 ()
+ {
+ string location = "whatever";
+
+ SoundPlayer player = new SoundPlayer (location);
+ Assert.IsFalse (player.IsLoadCompleted, "#1");
+ Assert.AreSame (location, player.SoundLocation, "#2");
+ Assert.AreEqual ("whatever", player.SoundLocation, "#3");
+ Assert.IsNull (player.Stream, "#4");
+ }
+
+ [Test]
+ public void Stream ()
+ {
+ MemoryStream ms = new MemoryStream ();
+
+ SoundPlayer player = new SoundPlayer ();
+ player.StreamChanged += new EventHandler (StreamChangedCounter);
+ player.Stream = ms;
+ Assert.AreSame (ms, player.Stream, "#A1");
+ Assert.IsFalse (player.IsLoadCompleted, "#A2");
+ Assert.AreEqual (1, stream_changed, "#A3");
+ player.Stream = ms;
+ Assert.AreSame (ms, player.Stream, "#B1");
+ Assert.IsFalse (player.IsLoadCompleted, "#B2");
+ Assert.AreEqual (1, stream_changed, "#B3");
+ player.Stream = null;
+ Assert.IsNull (player.Stream, "#C1");
+ Assert.IsFalse (player.IsLoadCompleted, "#C2");
+ Assert.AreEqual (2, stream_changed, "#C3");
+ player.Stream = null;
+ Assert.IsNull (player.Stream, "#D1");
+ Assert.IsFalse (player.IsLoadCompleted, "#D2");
+ Assert.AreEqual (2, stream_changed, "#D3");
+ }
+
+ void StreamChangedCounter (object sender, EventArgs e)
+ {
+ stream_changed++;
+ }
+ }
+}
+
+#endif