[eglib] Prefer <langinfo.h> to <localcharset.h>
[mono.git] / mcs / class / corlib / Test / System.Diagnostics.Contracts / ContractAssumeTest.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 ContractAssumeTest : TestContractBase {
18
19                 /// <summary>
20                 /// At runtime Contract.Assume() acts just like a Contract.Assert(), except the exact message in the assert
21                 /// or exception is slightly different.
22                 /// </summary>
23                 [Test]
24                 //[Ignore ("This causes NUnit crash on .NET 4.0")]
25                 public void TestAssumeMessage ()
26                 {
27                         try {
28                                 Contract.Assume (false);
29                                 Assert.Fail ("TestAssumeMessage() exception not thrown #1");
30                         } catch (Exception ex) {
31                                 Assert.AreEqual ("Assumption failed.", ex.Message);
32                         }
33
34                         try {
35                                 Contract.Assume (false, "Message");
36                                 Assert.Fail ("TestAssumeMessage() exception not thrown #1");
37                         } catch (Exception ex) {
38                                 Assert.AreEqual ("Assumption failed.  Message", ex.Message);
39                         }
40                 }
41
42                 // Identical to Contract.Assert, so no more testing required.
43
44         }
45
46 }
47
48 #endif