[w32file] Move MonoIO.Find{First,Next,Close} to managed
[mono.git] / mcs / tests / gtest-linq-23.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4
5 namespace OrderByBugExample
6 {
7         class Foo
8         {
9                 public string Name { get; set; }
10                 public int Value1 { get; set; }
11                 public int Value2 { get; set; }
12         }
13
14         static class Program
15         {
16                 public static int Main ()
17                 {
18                         List<Foo> test = new List<Foo> ()
19                         { 
20                                 new Foo { Name="b", Value1=37, Value2=2 },
21                                 new Foo { Name="b", Value1=37, Value2=1 }
22                         };
23
24                         // Sort using a linq expression. Mono 2.6.1 ignores item.Value2, which is incorrect behaviour.
25                         var result = from item in test
26                                                  orderby item.Name, item.Value1, item.Value2
27                                                  select item;
28
29                         var r = result.ToList ();
30
31                         foreach (Foo item in r)
32                                 Console.WriteLine ("{0}, {1}, {2}", item.Name, item.Value1, item.Value2);
33
34                         if (r[0].Value2 != 1 && r[1].Value2 != 2)
35                                 return 1;
36
37                         Console.WriteLine ("ok");
38                         return 0;
39                 }
40         }
41 }