Add tests for empty, non-modifiable SortDesriptionCollection
authorAntonius Riha <antoniusriha@gmail.com>
Thu, 2 Jan 2014 16:24:28 +0000 (17:24 +0100)
committerAntonius Riha <antoniusriha@gmail.com>
Thu, 2 Jan 2014 16:31:22 +0000 (17:31 +0100)
mcs/class/WindowsBase/Test/System.ComponentModel/SortDescriptionCollectionTest.cs

index 9c1e3d5e6681e83862d4e397ca75f37a8a4c0bc1..cfde0f6813f518437c7a17783286a543bc6f3396 100644 (file)
@@ -152,5 +152,51 @@ namespace MonoTests.System.ComponentModel {
                        Assert.AreEqual (ListSortDirection.Descending, addedItem.Direction, "ADD_#2");
                        Assert.AreEqual (true, addedItem.IsSealed, "ADD_#3");
                }
+
+               [Test]
+               public void GetEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       CollectionAssert.IsEmpty (collection, "A1");
+               }
+
+               [Test]
+               [ExpectedException (typeof(NotSupportedException))]
+               public void AddToEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       collection.Add (new SortDescription ());
+               }
+
+               [Test]
+               public void RemoveFromEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       Assert.IsFalse (collection.Remove (new SortDescription ()), "A1");
+               }
+
+               [Test]
+               [ExpectedException (typeof(NotSupportedException))]
+               public void RemoveAtIndexFromEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       collection.RemoveAt (0);
+               }
+
+               [Test]
+               [ExpectedException (typeof(NotSupportedException))]
+               public void ClearEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       collection.Clear ();
+               }
+
+               [Test]
+               [ExpectedException (typeof(NotSupportedException))]
+               public void InsertIntoEmptyCollection ()
+               {
+                       var collection = SortDescriptionCollection.Empty;
+                       collection.Insert (0, new SortDescription ());
+               }
        }
 }