[System.Net.Http] HttpClient timeout range checks. Fixes #25755
[mono.git] / mcs / tests / test-pattern-07.cs
1 // Compiler options: -langversion:experimental
2
3 using System;
4
5 class PropertyPattern
6 {
7         static int Main ()
8         {
9                 object o = new DateTime (2014, 8, 30);
10
11                 if (!(o is DateTime { Day is 30 }))
12                         return 1;
13
14                 if (!(o is DateTime { Month is 8, Day is 30, Year is * }))
15                         return 2;
16
17                 if (o is X { Field is 30 })
18                         return 3;
19
20                 object o2 = new X () {
21                         Field = new Y () {
22                                 Prop = 'f'
23                         }
24                 };
25
26                 bool res2 = o2 is X { Field is Y { Prop is 'f' }, Field is Y (4) };
27                 if (!res2)
28                         return 4;
29
30                 res2 = o2 is X { Field is Y { Prop is 'g' } };
31                 if (res2)
32                         return 5;
33
34                 object o3 = new X () {
35                         Value = 5
36                 };
37
38                 if (o3 is X { Value is 6 })
39                         return 6;
40
41                 if (!(o3 is X { Value is 5 }))
42                         return 7;
43
44                 object o4 = new X () {
45                         NullableValue = 4
46                 };
47
48                 bool res3 = o4 is X { NullableValue is (byte) 4 };
49                 if (!res3)
50                         return 8;
51
52                 Console.WriteLine("ok");
53                 return 0;
54         }
55 }
56
57 class X
58 {
59         public object Field { get; set; }
60
61         public object Value { get; set; }
62
63         public long? NullableValue { get; set; }
64 }
65
66 class Y
67 {
68         public char Prop { get; set; }
69
70         public static bool operator is (Y y, out int x)
71         {
72                 x = 4;
73                 return true;
74         }
75 }