~ubuntu-branches/ubuntu/utopic/monodevelop/utopic

« back to all changes in this revision

Viewing changes to external/debugger-libs/UnitTests/UnitTests/UnitTests.TestApp/Main.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-10-10 14:50:04 UTC
  • mfrom: (10.3.4)
  • Revision ID: package-import@ubuntu.com-20131010145004-80l130sny21b17sb
Tags: 4.0.12+dfsg-1
* [5dcb6e1] Fix debian/watch for new source tarball name format
* [5c68cb5] Refresh list of files removed by get-orig-source to 
  reflect 4.0.12
* [96d60a0] Imported Upstream version 4.0.12+dfsg
* [b989752] Refresh debian/patches/no_appmenu to ensure it applies
* [2a4c351] Ensure every assembly in external/ is cleaned properly
* [92762f7] Add more excluded Mac-specific modulerefs
* [bc698ba] Add symlinks to NUnit assemblies (Closes: #714246)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// Main.cs
 
3
//  
 
4
// Author:
 
5
//       Lluis Sanchez Gual <lluis@novell.com>
 
6
// 
 
7
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
 
 
27
using System;
 
28
using System.Collections;
 
29
using System.Collections.Generic;
 
30
using System.Diagnostics;
 
31
 
 
32
namespace UnitTests.TestApp
 
33
{
 
34
        class MainClass
 
35
        {
 
36
                public static void Main (string[] args)
 
37
                {
 
38
                        MainClass mc = new MainClass ();
 
39
                        typeof (MainClass).GetMethod (args[0]).Invoke (mc, null);
 
40
                }
 
41
 
 
42
                // Tests
 
43
 
 
44
                static string staticString = "some static";
 
45
                string someString = "hi";
 
46
                string[] numbers = new string[] { "one","two","three" };
 
47
 
 
48
                public void TestEvaluation ()
 
49
                {
 
50
                        int n = 32;
 
51
                        decimal dec = 123.456m;
 
52
                        ArrayList alist = new ArrayList ();
 
53
                        alist.Add (1);
 
54
                        alist.Add ("two");
 
55
                        alist.Add (3);
 
56
 
 
57
                        A c = new C ();
 
58
                        A b = new B ();
 
59
                        A a = new A ();
 
60
 
 
61
                        WithDisplayString withDisplayString = new WithDisplayString ();
 
62
                        WithProxy withProxy = new WithProxy ();
 
63
                        WithToString withToString = new WithToString ();
 
64
 
 
65
                        int[][] numbersArrays = new int [2][];
 
66
                        int[,,] numbersMulti = new int [3,4,5];
 
67
 
 
68
                        var dict = new Dictionary<int, string[]> ();
 
69
                        var dictArray = new Dictionary<int, string[]> [2,3];
 
70
                        var thing = new Thing<string> ();
 
71
                        var done = new Thing<string>.Done<int> ();
 
72
 
 
73
                        Console.WriteLine (n); Debugger.Break ();
 
74
                }
 
75
 
 
76
                public int TestMethod ()
 
77
                {
 
78
                        float c = 4;
 
79
                        return 1;
 
80
                }
 
81
 
 
82
                public int TestMethod (string a)
 
83
                {
 
84
                        return int.Parse (a) + 1;
 
85
                }
 
86
 
 
87
                public int TestMethod (int a)
 
88
                {
 
89
                        return a + 1;
 
90
                }
 
91
 
 
92
                public static int TestMethod (bool b)
 
93
                {
 
94
                        return b ? 1 : 2;
 
95
                }
 
96
 
 
97
                public string BoxingTestMethod (object a)
 
98
                {
 
99
                        return a.ToString ();
 
100
                }
 
101
 
 
102
                public string EscapedStrings {
 
103
                        get { return " \" \\ \a \b \f \v \n \r \t"; }
 
104
                }
 
105
        }
 
106
}
 
107
 
 
108
class A
 
109
{
 
110
        public virtual int Prop { get { return 1; } }
 
111
        public int PropNoVirt1 { get { return 1; } }
 
112
        public virtual int PropNoVirt2 { get { return 1; } }
 
113
}
 
114
 
 
115
class B: A
 
116
{
 
117
        public override int Prop { get { return 2; } }
 
118
        public new int PropNoVirt1 { get { return 2; } }
 
119
        public new int PropNoVirt2 { get { return 2; } }
 
120
}
 
121
 
 
122
class C: B
 
123
{
 
124
}
 
125
 
 
126
[DebuggerDisplay ("Some {Val1} Value {Val2} End")]
 
127
class WithDisplayString
 
128
{
 
129
        internal string Val1 = "one";
 
130
        public int Val2 { get { return 2; } }
 
131
}
 
132
 
 
133
class WithToString
 
134
{
 
135
        public override string ToString ()
 
136
        {
 
137
                return "SomeString";
 
138
        }
 
139
}
 
140
 
 
141
[DebuggerTypeProxy (typeof(TheProxy))]
 
142
class WithProxy
 
143
{
 
144
        public string Val1 {
 
145
                get { return "one"; }
 
146
        }
 
147
}
 
148
 
 
149
class TheProxy
 
150
{
 
151
        WithProxy wp;
 
152
 
 
153
        public TheProxy (WithProxy wp)
 
154
        {
 
155
                this.wp = wp;
 
156
        }
 
157
 
 
158
        public string Val1 {
 
159
                get { return wp.Val1; } 
 
160
        }
 
161
}
 
162
 
 
163
class Thing<T>
 
164
{
 
165
        public class Done<U>
 
166
        {
 
167
        }
 
168
 
 
169
        public Done<int>[] done = new Done<int> [1];
 
170
}
 
171
 
 
172
[Flags]
 
173
enum SomeEnum
 
174
{
 
175
        none=0,
 
176
        one=1,
 
177
        two=2,
 
178
        four=4
 
179
}