2 // InvalidProjectFileExceptionTest.cs:
5 // Marek Sieradzki (marek.sieradzki@gmail.com)
7 // (C) 2005 Marek Sieradzki
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:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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.
30 using System.Reflection;
32 using Microsoft.Build.BuildEngine;
33 using NUnit.Framework;
35 namespace MonoTests.Microsoft.Build.BuildEngine {
37 public class InvalidProjectFileExceptionTest {
39 public void TestCtorMessage ()
41 InvalidProjectFileException ipfe;
42 string message = "message";
44 ipfe = new InvalidProjectFileException (message);
46 Assert.AreEqual (message, ipfe.Message, "Message");
50 public void TestCtorProjectFile ()
52 InvalidProjectFileException ipfe;
53 string projectFile = "projectFile";
56 int endLineNumber = 3;
57 int endColumnNumber = 4;
58 string message = "message";
59 string errorSubcategory = "errorSubcategory";
60 string errorCode = "CS0000";
61 string helpKeyword = "helpKeyword";
63 ipfe = new InvalidProjectFileException (projectFile, lineNumber, columnNumber, endLineNumber, endColumnNumber,
64 message, errorSubcategory, errorCode, helpKeyword);
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");
79 public void TestCtorMessageException ()
81 string message = "message";
82 Exception e = new Exception ("Exception message");
84 new InvalidProjectFileException (message, e);
88 public void TestCtorNode ()
90 // FIXME: we need to load xml file to load something with non-empty XmlElement.BaseUri
92 XmlDocument xd = new XmlDocument ();
94 InvalidProjectFileException ipfe;
96 string message = "message";
97 string errorSubcategory = "errorSubcategory";
98 string errorCode = "CS0000";
99 string helpKeyword = "helpKeyword";
101 ipfe = new InvalidProjectFileException (null, message, errorSubcategory, errorCode, helpKeyword);
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");