2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / class / System.Windows.Browser / Test / System.Windows / WebApplicationTest.cs
blob11207bbeeb0c4c117352d0647dbd2789adc15254
1 using System;
2 using System.Windows;
3 using System.Windows.Browser;
5 using NUnit.Framework;
7 namespace MonoTests.System.Windows
9 [TestFixture]
10 public class WebApplicationTest
12 [Scriptable]
13 class Scriptable1
15 [Scriptable]
16 public int Foo {
17 get { return 0; }
21 [Scriptable]
22 class Scriptable2
24 [Scriptable]
25 public event EventHandler MyEvent;
28 [Scriptable]
29 class Scriptable3
31 [Scriptable]
32 public string MyMethod (int i, string s, double d)
34 return null;
38 class Scriptable4
40 [Scriptable]
41 public string MyMethod (int i, string s, double d)
43 return null;
47 [Scriptable]
48 class Scriptable5
50 public string MyMethod (int i, string s, double d)
52 return null;
56 [Scriptable]
57 class Scriptable6
59 [Scriptable]
60 public decimal MyMethod (int i)
62 return 0;
66 [Scriptable]
67 class Scriptable7
69 [Scriptable]
70 public string MyMethod (Uri u)
72 return null;
76 WebApplication app = WebApplication.Current;
78 [Test]
79 [ExpectedException (typeof (ArgumentNullException))]
80 public void RegisterScriptableObjectNameNull ()
82 app.RegisterScriptableObject (null, new Scriptable1 ());
85 [Test]
86 [ExpectedException (typeof (ArgumentNullException))]
87 public void RegisterScriptableObjectInstanceNull ()
89 app.RegisterScriptableObject ("my", null);
92 [Test]
93 [Category ("NotWorking")]
94 public void RegisterScriptableObject ()
96 app.RegisterScriptableObject ("hoge", new Scriptable1 ());
97 app.RegisterScriptableObject ("hoge2", new Scriptable2 ());
98 app.RegisterScriptableObject ("hoge3", new Scriptable3 ());
99 try {
100 app.RegisterScriptableObject ("hoge4", new Scriptable4 ());
101 Assert.Fail ("#4");
102 } catch (NotSupportedException) {
104 try {
105 app.RegisterScriptableObject ("hoge5", new Scriptable5 ());
106 Assert.Fail ("#5");
107 } catch (ArgumentException) {
109 try {
110 app.RegisterScriptableObject ("hoge6", new Scriptable6 ());
111 Assert.Fail ("#6");
112 } catch (NotSupportedException) {
114 try {
115 app.RegisterScriptableObject ("hoge7", new Scriptable7 ());
116 Assert.Fail ("#7");
117 } catch (NotSupportedException) {