public void ExtendedObservableCollection_RemoveNullHandlerTest()
 {
     using (var verify = new Verify())
     {
         var list = new ObservableCollectionExtended<int>();
         var result = new ReadOnlyObservableCollectionExtended<int>(list);
         verify.ArgumentNullException("eventHandler", () => result.RemoveHandler((IListener<NotifyCollectionChangedEventArgs>)null));
         verify.ArgumentNullException("eventHandler", () => result.RemoveHandler((IListener<PropertyChangedEventArgs>)null));
     }
 }
        public void ExtendedObservableCollection_AddNullHandlerTest()
        {
            using (var verify = new Verify())
            {
                var result = new FooCollection();

                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<NotifyCollectionChangedEventArgs>)null));
                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<PropertyChangedEventArgs>)null));
                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<RelayedEventArgs<PropertyChangedEventArgs>>)null));
            }
        }
 public void WeakReferenceCollection_Add()
 {
     using (var verify = new Verify())
     {
         var result = new WeakReferenceCollection<string>();
         verify.ArgumentNullException("item", () => result.Add(null));
     }
 }
 public void CollectionUtilities_AddRange_Test2()
 {
     using (var verify = new Verify())
     {
         List<string> target = null;
         List<string> list = null;
         verify.ArgumentNullException("target", () => CollectionUtilities.AddRange(target, list));
     }
 }
Beispiel #5
0
 public void CollectionUtilities_AddRange_Test8()
 {
     using (var verify = new Verify())
     {
         List <string> target = null;
         string[]      list   = null;
         verify.ArgumentNullException("target", () => CollectionUtilities.AddRange(target, list));
     }
 }
 public void WeakReferenceCollection_AddRange_Test1()
 {
     using (var verify = new Verify())
     {
         IList <string> list   = null;
         var            result = new WeakReferenceCollection <string>();
         verify.ArgumentNullException("list", () => result.AddRange(list));
     }
 }
Beispiel #7
0
 public void CollectionUtilities_InsertRange_Test2()
 {
     using (var verify = new Verify())
     {
         List <string> target = null;
         List <string> list   = null;
         verify.ArgumentNullException("target", () => CollectionUtilities.InsertRange(target, 0, list));
     }
 }
 public void WeakReferenceCollection_AddRange_Test1()
 {
     using (var verify = new Verify())
     {
         IList<string> list = null;
         var result = new WeakReferenceCollection<string>();
         verify.ArgumentNullException("list", () => result.AddRange(list));
     }
 }
 public void CollectionUtilities_RemoveRange_Test1()
 {
     using (var verify = new Verify())
     {
         List<string> list = null;
         verify.ArgumentNullException("list", () => CollectionUtilities.RemoveRange(list, 0, 1));
     }
 }
 public void CollectionUtilities_InsertRange_Test1()
 {
     using (var verify = new Verify())
     {
         List<string> target = new List<string>();
         List<string> list = null;
         verify.ArgumentNullException("list", () => CollectionUtilities.InsertRange(target, 0, list));
     }
 }
Beispiel #11
0
 public void MetadataCache_Test2b()
 {
     using (var verify = new Verify())
     {
         verify.ArgumentNullException("type", () => MetadataCache.GetMetadata((TypeInfo)null));
     }
 }
Beispiel #12
0
 public void MetadataCache_Test17()
 {
     using (var verify = new Verify())
     {
         var result = MetadataCache.GetMetadata(typeof(Mock));
         verify.ArgumentNullException("item", () => result.Properties.Contains((PropertyMetadata)null));
     }
 }
        public void WeakReferenceCollection_Remove_Test1()
        {
            using (var verify = new Verify())
            {
                string item1 = "AAA";
                string item2 = "BBB";

                var list = new List<string>();
                list.Add(item1);
                list.Add(item2);

                var result = new WeakReferenceCollection<string>();
                result.AddRange(list);
                verify.ItemsAreEqual(new[] { "AAA", "BBB" }, result, "Two items should have been in the collection.");

                verify.IsTrue(result.Remove(item2), "item 1 should have been removable");

                verify.ItemsAreEqual(new[] { "AAA" }, result, "One item should have been left in the collection.");

                verify.IsTrue(result.Remove(item1), "item 2 should have been removable");

                verify.IsEmpty(result, "Removal failed");

                verify.IsFalse(result.Remove(item1), "item was already removed");

                verify.ArgumentNullException("item", () => result.Remove(null));

            }
        }
 public void WeakReferenceCollection_CopyTo_Test1()
 {
     using (var verify = new Verify())
     {
         var result = new WeakReferenceCollection<string>();
         verify.ArgumentNullException("array", () => result.CopyTo(null, 0));
     }
 }