[System] UriKind.RelativeOrAbsolute workaround.
[mono.git] / mcs / class / corlib / Test / System.Diagnostics.Contracts / ContractMarkerMethodsTest.cs
1 #if NET_4_0
2
3 #define CONTRACTS_FULL
4 #define DEBUG
5
6 using System;
7 using System.Collections.Generic;
8 using System.Linq;
9 using System.Text;
10 using NUnit.Framework;
11 using System.Diagnostics.Contracts;
12 using MonoTests.System.Diagnostics.Contracts.Helpers;
13
14 namespace MonoTests.System.Diagnostics.Contracts {
15
16         [TestFixture]
17         public class ContractMarkerMethodsTest : TestContractBase {
18
19                 /// <summary>
20                 /// Contract.EndContractBlock() has no effects.
21                 /// </summary>
22                 [Test, RunAgainstReference]
23                 public void TestEndContractBlock ()
24                 {
25                         Contract.EndContractBlock ();
26                 }
27
28                 /// <summary>
29                 /// Contract.OldValue() has no effect, and always returns the default value for the type.
30                 /// </summary>
31                 [Test, RunAgainstReference]
32                 public void TestOldValue ()
33                 {
34                         int i = Contract.OldValue<int> (8);
35                         object o = Contract.OldValue<object> (new object ());
36
37                         Assert.AreEqual (0, i, "TestOldValue() int value wrong");
38                         Assert.IsNull (o, "TestOldValue() object value wrong");
39                 }
40
41                 /// <summary>
42                 /// Contract.Result() has no effect, and always returns the default value for the type.
43                 /// </summary>
44                 [Test, RunAgainstReference]
45                 public void TestResult ()
46                 {
47                         int i = Contract.Result<int> ();
48                         object o = Contract.Result<object> ();
49
50                         Assert.AreEqual (0, i, "TestResult() int value wrong");
51                         Assert.IsNull (o, "TestResult() object value wrong");
52                 }
53
54                 /// <summary>
55                 /// Contract.ValueAtReturn() has no effect, and always returns the default value for the type.
56                 /// </summary>
57                 [Test, RunAgainstReference]
58                 public void TestValueAtReturn ()
59                 {
60                         int iOut, i;
61                         object oOut, o;
62
63                         i = Contract.ValueAtReturn (out iOut);
64                         o = Contract.ValueAtReturn (out oOut);
65
66                         Assert.AreEqual (0, i, "TestValueAtReturn() int return value wrong");
67                         Assert.IsNull (o, "TestValueAtReturn() object return value wrong");
68                         Assert.AreEqual (0, iOut, "TestValueAtReturn() int out value wrong");
69                         Assert.IsNull (oOut, "TestValueAtReturn() object out value wrong");
70                 }
71
72         }
73
74 }
75
76 #endif