[System.Net.Http] HttpClient timeout range checks. Fixes #25755
[mono.git] / mcs / tests / gtest-initialize-02.cs
1
2 // Uber-test for object and collection initialization
3 using System;
4 using System.Collections.Generic;
5
6 public class Test
7 {
8         private class Point
9         {
10                 public int X;
11                 public int Y;
12         }
13         private class Line
14         {
15                 public Point P1 = new Point ();
16                 public Point P2 = new Point ();
17         }
18         private class Rectangle
19         {
20                 public Line Top = new Line ();
21                 public Line Right = new Line ();
22                 public Line Left = new Line ();
23                 public Line Bottom = new Line ();
24         }
25         private class Library
26         {
27                 public string Name;
28                 public string PhoneNumber;
29                 public List<string>  Books;
30                 public Library ()
31                 {
32                         Books = new List<string> { "Tale of Two Cities", "Catcher in the Rye", "Great Gatsby" };
33                 }
34         }
35         private class Thing
36         {
37                 public int Number;
38                 public string Name;
39         }
40         private class Box
41         {
42                 public Thing Thing1;
43                 public Thing Thing2;
44         }
45         public static int Main ()
46         {
47                 Thing thing1 = new Thing() { Number = 1, Name = "Bob" };
48                 
49                 Line line = new Line { P1 = { X = 1, Y = 5 }, P2 = { X = 3, Y = 6 } };
50                 if (line.P1.X != 1 || line.P1.Y != 5 || line.P2.X != 3 || line.P2.Y != 6)
51                         return 1;
52
53                 Rectangle rectangle = new Rectangle () {
54                         Top = {
55                                 P1 = { X = 0, Y = 5 },
56                                 P2 = { X = 5, Y = 5 } },
57                         Bottom = {
58                                 P1 = { X = 0, Y = 0, },
59                                 P2 = { X = 5, Y = 0, }, },
60                         Right = {
61                                 P1 = { X = 5, Y = 5 },
62                                 P2 = { X = 5, Y = 0 } },
63                         Left = {
64                                 P1 = { X = 0, Y = 0, },
65                                 P2 = { X = 0, Y = 5 } } };
66                 if (rectangle.Top.P1.X != 0 || rectangle.Bottom.P2.X != 5 || rectangle.Right.P2.Y != 0 || rectangle.Left.P1.Y != 0)
67                         return 2;
68
69                 List<string> list = new List<string> (3) { "Foo", "Bar", "Baz" };
70                 if (list[0] != "Foo" || list[1] != "Bar" || list[2] != "Baz")
71                         return 3;
72
73                 Library library = new Library {
74                         Name = "New York Public Library",
75                         Books = { "Grapes of Wrath", "Dracula", },
76                         PhoneNumber = "212-621-0626" };
77                 if (library.Name != "New York Public Library" || library.PhoneNumber != "212-621-0626" ||
78                         library.Books[0] != "Tale of Two Cities" ||
79                         library.Books[1] != "Catcher in the Rye" ||
80                         library.Books[2] != "Great Gatsby" ||
81                         library.Books[3] != "Grapes of Wrath" ||
82                         library.Books[4] != "Dracula")
83                         return 4;
84
85                 Box box = new Box {
86                         Thing1 = new Thing { Number = 1, Name = "Wilber" },
87                         Thing2 = new Thing() { Number = 2, Name = "Chris" } };
88                 if (box.Thing1.Number != 1 || box.Thing1.Name != "Wilber" || box.Thing2.Number != 2 || box.Thing2.Name != "Chris")
89                         return 5;
90                 
91                 Library library2 = new Library { Books = new List<string> { "The Hound of Baskerville", "Flatland", "The Origin of Species" } };
92                 if (library2.Books[0] != "The Hound of Baskerville" ||
93                         library2.Books[1] != "Flatland" ||
94                         library2.Books[2] != "The Origin of Species")
95                         return 6;
96
97                 return 0;
98         }
99 }