7 using System.Collections.Generic;
10 using NUnit.Framework;
11 using System.Diagnostics.Contracts;
12 using MonoTests.System.Diagnostics.Contracts.Helpers;
14 namespace MonoTests.System.Diagnostics.Contracts {
17 public class ContractMarkerMethodsTest : TestContractBase {
20 /// Contract.EndContractBlock() has no effects.
22 [Test, RunAgainstReference]
23 public void TestEndContractBlock ()
25 Contract.EndContractBlock ();
29 /// Contract.OldValue() has no effect, and always returns the default value for the type.
31 [Test, RunAgainstReference]
32 public void TestOldValue ()
34 int i = Contract.OldValue<int> (8);
35 object o = Contract.OldValue<object> (new object ());
37 Assert.AreEqual (0, i, "TestOldValue() int value wrong");
38 Assert.IsNull (o, "TestOldValue() object value wrong");
42 /// Contract.Result() has no effect, and always returns the default value for the type.
44 [Test, RunAgainstReference]
45 public void TestResult ()
47 int i = Contract.Result<int> ();
48 object o = Contract.Result<object> ();
50 Assert.AreEqual (0, i, "TestResult() int value wrong");
51 Assert.IsNull (o, "TestResult() object value wrong");
55 /// Contract.ValueAtReturn() has no effect, and always returns the default value for the type.
57 [Test, RunAgainstReference]
58 public void TestValueAtReturn ()
63 i = Contract.ValueAtReturn (out iOut);
64 o = Contract.ValueAtReturn (out oOut);
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");