From 9e20dc9fa855f331531181eadca1571e720f995a Mon Sep 17 00:00:00 2001 From: Antonius Riha Date: Thu, 2 Jan 2014 17:24:28 +0100 Subject: [PATCH] Add tests for empty, non-modifiable SortDesriptionCollection --- .../SortDescriptionCollectionTest.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) 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 ()); + } } } -- 2.25.1