From: Antonius Riha Date: Thu, 2 Jan 2014 16:24:28 +0000 (+0100) Subject: Add tests for empty, non-modifiable SortDesriptionCollection X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=9e20dc9fa855f331531181eadca1571e720f995a;p=mono.git Add tests for empty, non-modifiable SortDesriptionCollection --- diff --git a/mcs/class/WindowsBase/Test/System.ComponentModel/SortDescriptionCollectionTest.cs b/mcs/class/WindowsBase/Test/System.ComponentModel/SortDescriptionCollectionTest.cs index 9c1e3d5e668..cfde0f6813f 100644 --- a/mcs/class/WindowsBase/Test/System.ComponentModel/SortDescriptionCollectionTest.cs +++ b/mcs/class/WindowsBase/Test/System.ComponentModel/SortDescriptionCollectionTest.cs @@ -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 ()); + } } }