Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / corlib / Test / System.Collections.Generic / ComparerTest.cs
index 2491120e5dfc59b3fe1da4b2456e18009a277a9e..e58afc0b8cd1809ce597aea01592257f2f089f11 100644 (file)
@@ -5,6 +5,7 @@
 //      Gert Driesen (drieseng@users.sourceforge.net)
 //
 // Copyright (C) 2007 Gert Driesen
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System.Collections.Generic;
 using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;
 
 using NUnit.Framework;
+using System;
 
 namespace MonoTests.System.Collections.Generic
 {
        [TestFixture]
        public class ComparerTest
        {
+#if NET_4_5
+               [Test]
+               public void Create ()
+               {
+                       var comparer = Comparer<int>.Create ((a, b) => a - b);
+                       Assert.AreEqual (-1, comparer.Compare (1, 2), "#1");
+               }
+
+               [Test]
+               public void Create_Invalid ()
+               {
+                       try {
+                               Comparer<int>.Create (null);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentNullException) {
+                       }
+               }
+#endif
+
+#if !NET_4_0 && !NET_2_1 // FIXME: the blob contains the 2.0 mscorlib version
+
                [Test] // bug #80929
                public void SerializeDefault ()
                {
@@ -55,6 +76,8 @@ namespace MonoTests.System.Collections.Generic
                        Assert.AreEqual (_serializedDefault, buffer);
                }
 
+#endif
+
                [Test]
                public void DeserializeDefault ()
                {
@@ -86,6 +109,3 @@ namespace MonoTests.System.Collections.Generic
                        0x0b };
        }
 }
-
-#endif
-