* VBCodeGenerator.cs: Fixed generated code for abstract properties.
[mono.git] / mcs / class / System / Test / System.CodeDom / CodeSnippetCompileUnitTest.cs
1 //
2 // CodeSnippetCompileUnitTest.cs
3 //      - Unit tests for System.CodeDom.CodeSnippetCompileUnit
4 //
5 // Author:
6 //      Gert Driesen  <drieseng@users.sourceforge.net>
7 //
8 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using NUnit.Framework;
31
32 using System;
33 using System.CodeDom;
34 using System.Collections.Specialized;
35
36 namespace MonoTests.System.CodeDom
37 {
38         [TestFixture]
39         public class CodeSnippetCompileUnitTest
40         {
41 #if NET_2_0
42                 [Test]
43                 public void Constructor0 ()
44                 {
45                         CodeSnippetCompileUnit cscu = new CodeSnippetCompileUnit ();
46                         Assert.IsNull (cscu.LinePragma, "#1");
47
48                         Assert.IsNotNull (cscu.Value, "#2");
49                         Assert.AreEqual (string.Empty, cscu.Value, "#3");
50
51                         Assert.IsNotNull (cscu.AssemblyCustomAttributes, "#4");
52                         Assert.AreEqual (0, cscu.AssemblyCustomAttributes.Count, "#5");
53
54                         Assert.IsNotNull (cscu.EndDirectives, "#6");
55                         Assert.AreEqual (0, cscu.EndDirectives.Count, "#7");
56
57                         Assert.IsNotNull (cscu.Namespaces, "#8");
58                         Assert.AreEqual (0, cscu.Namespaces.Count, "#9");
59
60                         Assert.IsNotNull (cscu.ReferencedAssemblies, "#10");
61                         Assert.AreEqual (0, cscu.ReferencedAssemblies.Count, "#11");
62
63                         Assert.IsNotNull (cscu.StartDirectives, "#12");
64                         Assert.AreEqual (0, cscu.StartDirectives.Count, "#13");
65
66                         Assert.IsNotNull (cscu.UserData, "#14");
67                         Assert.AreEqual (typeof(ListDictionary), cscu.UserData.GetType (), "#15");
68                         Assert.AreEqual (0, cscu.UserData.Count, "#16");
69                         
70                         cscu.Value = null;
71                         Assert.IsNotNull (cscu.Value, "#17");
72                         Assert.AreEqual (string.Empty, cscu.Value, "#18");
73
74                         CodeLinePragma clp = new CodeLinePragma ("mono", 10);
75                         cscu.LinePragma = clp;
76                         Assert.IsNotNull (cscu.LinePragma, "#19");
77                         Assert.AreSame (clp, cscu.LinePragma, "#20");
78                 }
79 #endif
80
81                 [Test]
82                 public void Constructor1 ()
83                 {
84                         string value = "mono";
85
86                         CodeSnippetCompileUnit cscu = new CodeSnippetCompileUnit (value);
87                         Assert.IsNull (cscu.LinePragma, "#1");
88
89                         Assert.IsNotNull (cscu.Value, "#2");
90                         Assert.AreEqual (value, cscu.Value, "#3");
91                         Assert.AreSame (value, cscu.Value, "#4"); 
92
93                         Assert.IsNotNull (cscu.AssemblyCustomAttributes, "#5");
94                         Assert.AreEqual (0, cscu.AssemblyCustomAttributes.Count, "#6");
95
96                         Assert.IsNotNull (cscu.Namespaces, "#7");
97                         Assert.AreEqual (0, cscu.Namespaces.Count, "#8");
98
99                         Assert.IsNotNull (cscu.ReferencedAssemblies, "#9");
100                         Assert.AreEqual (0, cscu.ReferencedAssemblies.Count, "#10");
101
102 #if NET_2_0
103                         Assert.IsNotNull (cscu.StartDirectives, "#11");
104                         Assert.AreEqual (0, cscu.StartDirectives.Count, "#12");
105
106                         Assert.IsNotNull (cscu.EndDirectives, "#13");
107                         Assert.AreEqual (0, cscu.EndDirectives.Count, "#14");
108 #endif
109
110                         Assert.IsNotNull (cscu.UserData, "#15");
111                         Assert.AreEqual (typeof(ListDictionary), cscu.UserData.GetType (), "#16");
112                         Assert.AreEqual (0, cscu.UserData.Count, "#17");
113                         
114                         cscu.Value = null;
115                         Assert.IsNotNull (cscu.Value, "#18");
116                         Assert.AreEqual (string.Empty, cscu.Value, "#19");
117
118                         CodeLinePragma clp = new CodeLinePragma ("mono", 10);
119                         cscu.LinePragma = clp;
120                         Assert.IsNotNull (cscu.LinePragma, "#20");
121                         Assert.AreSame (clp, cscu.LinePragma, "#21");
122
123                         cscu = new CodeSnippetCompileUnit ((string) null);
124
125                         Assert.IsNotNull (cscu.Value, "#22");
126                         Assert.AreEqual (string.Empty, cscu.Value, "#23");
127                 }
128         }
129 }