* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Microsoft.Build.Engine / Test / Microsoft.Build.BuildEngine / InvalidProjectFileExceptionTest.cs
1 //
2 // InvalidProjectFileExceptionTest.cs:
3 //
4 // Author:
5 //   Marek Sieradzki (marek.sieradzki@gmail.com)
6 // 
7 // (C) 2005 Marek Sieradzki
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 using System;
29 using System.IO;
30 using System.Reflection;
31 using System.Xml;
32 using Microsoft.Build.BuildEngine;
33 using NUnit.Framework;
34
35 namespace MonoTests.Microsoft.Build.BuildEngine {
36         [TestFixture]
37         public class InvalidProjectFileExceptionTest {
38                 [Test]
39                 public void TestCtorMessage ()
40                 {
41                         InvalidProjectFileException ipfe;
42                         string message = "message";
43                         
44                         ipfe = new InvalidProjectFileException (message);
45                         
46                         Assert.AreEqual (message, ipfe.Message, "Message");
47                 }
48                 
49                 [Test]
50                 public void TestCtorProjectFile ()
51                 {
52                         InvalidProjectFileException ipfe;
53                         string projectFile = "projectFile";
54                         int lineNumber = 1;
55                         int columnNumber = 2;
56                         int endLineNumber = 3;
57                         int endColumnNumber = 4;
58                         string message = "message";
59                         string errorSubcategory = "errorSubcategory";
60                         string errorCode = "CS0000";
61                         string helpKeyword = "helpKeyword";
62                         
63                         ipfe = new InvalidProjectFileException (projectFile, lineNumber, columnNumber, endLineNumber, endColumnNumber,
64                                 message, errorSubcategory, errorCode, helpKeyword);
65                         
66                         Assert.AreEqual (projectFile, ipfe.ProjectFile, "A1");
67                         Assert.AreEqual (lineNumber, ipfe.LineNumber, "A2");
68                         Assert.AreEqual (columnNumber, ipfe.ColumnNumber, "A3");
69                         Assert.AreEqual (endLineNumber, ipfe.EndLineNumber, "A4");
70                         Assert.AreEqual (endColumnNumber, ipfe.EndColumnNumber, "A5");
71                         Assert.AreEqual (message, ipfe.BaseMessage, "A6");
72                         Assert.AreEqual (message + "  " + projectFile, ipfe.Message, "A7");
73                         Assert.AreEqual (errorSubcategory, ipfe.ErrorSubcategory, "A8");
74                         Assert.AreEqual (errorCode, ipfe.ErrorCode, "A9");
75                         Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "A10");
76                 }
77                 
78                 [Test]
79                 public void TestCtorMessageException ()
80                 {
81                         string message = "message";
82                         Exception e = new Exception ("Exception message");
83                         
84                         new InvalidProjectFileException (message, e);
85                 }
86                 
87                 [Test]
88                 public void TestCtorNode ()
89                 {
90                         // FIXME: we need to load xml file to load something with non-empty XmlElement.BaseUri
91                         /*
92                         XmlDocument xd = new XmlDocument ();
93                         
94                         InvalidProjectFileException ipfe;
95
96                         string message = "message";
97                         string errorSubcategory = "errorSubcategory";
98                         string errorCode = "CS0000";
99                         string helpKeyword = "helpKeyword";
100                         
101                         ipfe = new InvalidProjectFileException (null, message, errorSubcategory, errorCode, helpKeyword);
102                         
103                         Assert.AreEqual (message, ipfe.BaseMessage, "A1");
104                         Assert.AreEqual (errorSubcategory, ipfe.ErrorSubcategory, "A2");
105                         Assert.AreEqual (errorCode, ipfe.ErrorCode, "A3");
106                         Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "A4");
107                         */
108                 }
109         }
110 }