[System] Remove Process.Start and related API from TvOS/WatchOS.
[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 #if MONO_FEATURE_PROCESS_START
12
13 using System;
14 using System.Diagnostics;
15 using System.Text;
16
17 using NUnit.Framework;
18
19 namespace MonoTests.System.Diagnostics
20 {
21         [TestFixture]
22         public class ProcessStartInfoTest
23         {
24                 [Test]
25                 public void NotNullCommonProperties ()
26                 {
27                         // Force FileName and Arguments to null. The others are null by default.
28                         ProcessStartInfo info = new ProcessStartInfo (null, null);
29
30                         Assert.AreEqual (info.Arguments, String.Empty, "#1");
31                         Assert.AreEqual (info.Domain, String.Empty, "#2");
32                         Assert.AreEqual (info.FileName, String.Empty, "#3");
33                         Assert.AreEqual (info.UserName, String.Empty, "#4");
34                         Assert.AreEqual (info.Verb, String.Empty, "#5");
35                         Assert.AreEqual (info.WorkingDirectory, String.Empty, "#6");
36                 }
37
38                 [Test]
39                 public void StandardErrorOutputEncoding ()
40                 {
41                         ProcessStartInfo info = new ProcessStartInfo ();
42                         Assert.IsNull (info.StandardErrorEncoding, "#1");
43                         Assert.IsNull (info.StandardOutputEncoding, "#2");
44                 }
45
46                 [Test]
47                 [ExpectedException (typeof (InvalidOperationException))]
48                 public void StandardErrorEncodingWithoutRedirect ()
49                 {
50                         ProcessStartInfo info = new ProcessStartInfo ();
51                         info.FileName = "mono";
52                         info.StandardErrorEncoding = Encoding.UTF8;
53                         Process.Start (info);
54                 }
55
56                 [Test]
57                 [ExpectedException (typeof (InvalidOperationException))]
58                 public void StandardOutputEncodingWithoutRedirect ()
59                 {
60                         ProcessStartInfo info = new ProcessStartInfo ();
61                         info.FileName = "mono";
62                         info.StandardOutputEncoding = Encoding.UTF8;
63                         Process.Start (info);
64                 }
65         }
66 }
67
68 #endif // MONO_FEATURE_PROCESS_START