53de1f66db4342d6e78e2e942d9beed4d76220b1
[mono.git] / mcs / class / System / Test / System.Diagnostics / ProcessStartInfoTest.cs
1 //
2 // ProcessStartInfoTest.cs - NUnit Test Cases for System.Diagnostics.ProcessStartInfo
3 //
4 // Authors:
5 //   Ankit Jain <jankit@novell.com>
6 //   Atsushi Enomoto <atsushi@ximian.com>
7 //
8 // (c) 2007 Novell, Inc. (http://www.novell.com)
9 // 
10
11 using System;
12 using System.Diagnostics;
13 using System.Text;
14
15 using NUnit.Framework;
16
17 namespace MonoTests.System.Diagnostics
18 {
19         [TestFixture]
20         public class ProcessStartInfoTest
21         {
22                 [Test]
23                 public void NotNullCommonProperties ()
24                 {
25                         // Force FileName and Arguments to null. The others are null by default.
26                         ProcessStartInfo info = new ProcessStartInfo (null, null);
27
28                         Assert.AreEqual (info.Arguments, String.Empty, "#1");
29                         Assert.AreEqual (info.Domain, String.Empty, "#2");
30                         Assert.AreEqual (info.FileName, String.Empty, "#3");
31                         Assert.AreEqual (info.UserName, String.Empty, "#4");
32                         Assert.AreEqual (info.Verb, String.Empty, "#5");
33                         Assert.AreEqual (info.WorkingDirectory, String.Empty, "#6");
34                 }
35
36                 [Test]
37                 public void StandardErrorOutputEncoding ()
38                 {
39                         ProcessStartInfo info = new ProcessStartInfo ();
40                         Assert.IsNull (info.StandardErrorEncoding, "#1");
41                         Assert.IsNull (info.StandardOutputEncoding, "#2");
42                 }
43
44                 [Test]
45                 [ExpectedException (typeof (InvalidOperationException))]
46                 public void StandardErrorEncodingWithoutRedirect ()
47                 {
48                         ProcessStartInfo info = new ProcessStartInfo ();
49                         info.FileName = "mono";
50                         info.StandardErrorEncoding = Encoding.UTF8;
51                         Process.Start (info);
52                 }
53
54                 [Test]
55                 [ExpectedException (typeof (InvalidOperationException))]
56                 public void StandardOutputEncodingWithoutRedirect ()
57                 {
58                         ProcessStartInfo info = new ProcessStartInfo ();
59                         info.FileName = "mono";
60                         info.StandardOutputEncoding = Encoding.UTF8;
61                         Process.Start (info);
62                 }
63         }
64 }