[bcl] Remove more NET_2_0 checks from class libs
[mono.git] / mcs / class / System.XML / Test / System.Xml.Xsl / XsltExceptionTests.cs
1 //
2 // XsltExceptionTests.cs - Unit tests for System.Xml.Xsl.XsltException
3 //
4 // Author:
5 //      Gert Driesen <drieseng@users.sourceforge.net>
6 //
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
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
29 using NUnit.Framework;
30
31 using System;
32 using System.Runtime.Serialization;
33 using System.Xml.Xsl;
34
35 namespace MonoCasTests.System.Xml.Xsl {
36         [TestFixture]
37         public class XsltExceptionTests
38         {
39                 [Test]
40                 public void Constructor0 ()
41                 {
42                         XsltException xsltException = new XsltException ();
43                         Assert.AreEqual (0, xsltException.LineNumber, "#1");
44                         Assert.AreEqual (0, xsltException.LinePosition, "#2");
45                         Assert.AreEqual (string.Empty, xsltException.Message, "#3");
46                         Assert.IsNull (xsltException.SourceUri, "#4");
47                         Assert.IsNull (xsltException.InnerException, "#5");
48                         Assert.IsNull (xsltException.Source, "#6");
49                         Assert.IsNull (xsltException.StackTrace, "#7");
50                         Assert.IsNull (xsltException.TargetSite, "#8");
51                 }
52
53                 [Test]
54                 public void Constructor1 ()
55                 {
56                         string msg = "mono";
57
58                         XsltException xsltException = new XsltException (msg);
59                         Assert.AreEqual (0, xsltException.LineNumber, "#1");
60                         Assert.AreEqual (0, xsltException.LinePosition, "#2");
61                         Assert.AreEqual (msg, xsltException.Message, "#3");
62                         Assert.IsNull (xsltException.SourceUri, "#4");
63                         Assert.IsNull (xsltException.InnerException, "#5");
64                         Assert.IsNull (xsltException.Source, "#6");
65                         Assert.IsNull (xsltException.StackTrace, "#7");
66                         Assert.IsNull (xsltException.TargetSite, "#8");
67                 }
68
69                 [Test]
70                 public void Constructor2 ()
71                 {
72                         string msg = "mono";
73                         Exception cause = new ApplicationException ("cause");
74
75                         XsltException xsltException = new XsltException (msg, cause);
76                         Assert.AreEqual (0, xsltException.LineNumber, "#A1");
77                         Assert.AreEqual (0, xsltException.LinePosition, "#A2");
78                         Assert.AreEqual (msg, xsltException.Message, "#A3");
79                         Assert.IsNull (xsltException.SourceUri, "#A4");
80                         Assert.AreSame (cause, xsltException.InnerException, "#A5");
81                         Assert.IsNull (xsltException.Source, "#A6");
82                         Assert.IsNull (xsltException.StackTrace, "#A7");
83                         Assert.IsNull (xsltException.TargetSite, "#A8");
84                         xsltException = new XsltException ((string) null, cause);
85                         Assert.AreEqual (0, xsltException.LineNumber, "#B1");
86                         Assert.AreEqual (0, xsltException.LinePosition, "#B2");
87                         Assert.IsNotNull (xsltException.Message, "#B3");
88                         Assert.AreEqual (string.Empty, xsltException.Message, "#B4");
89                         Assert.IsNull (xsltException.SourceUri, "#B5");
90                         Assert.AreSame (cause, xsltException.InnerException, "#B6");
91                         Assert.IsNull (xsltException.Source, "#B7");
92                         Assert.IsNull (xsltException.StackTrace, "#B8");
93                         Assert.IsNull (xsltException.TargetSite, "#B9");
94                         xsltException = new XsltException (msg, (Exception) null);
95                         Assert.AreEqual (0, xsltException.LineNumber, "#C1");
96                         Assert.AreEqual (0, xsltException.LinePosition, "#C2");
97                         Assert.AreEqual (msg, xsltException.Message, "#C3");
98                         Assert.IsNull (xsltException.SourceUri, "#C4");
99                         Assert.IsNull (xsltException.InnerException, "#C5");
100                         Assert.IsNull (xsltException.Source, "#C6");
101                         Assert.IsNull (xsltException.StackTrace, "#C7");
102                         Assert.IsNull (xsltException.TargetSite, "#C8");
103                         xsltException = new XsltException ((string) null, (Exception) null);
104                         Assert.AreEqual (0, xsltException.LineNumber, "#D1");
105                         Assert.AreEqual (0, xsltException.LinePosition, "#D2");
106                         Assert.AreEqual (string.Empty, xsltException.Message, "#D3");
107                         Assert.IsNull (xsltException.SourceUri, "#D4");
108                         Assert.IsNull (xsltException.InnerException, "#D5");
109                         Assert.IsNull (xsltException.Source, "#D6");
110                         Assert.IsNull (xsltException.StackTrace, "#D7");
111                         Assert.IsNull (xsltException.TargetSite, "#D8");
112                 }
113         }
114 }