Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Add AddToNullCollection test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkoshevoi committed Feb 13, 2021
1 parent e8b93a4 commit 83e35db
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using Xamarin.CommunityToolkit.ObjectModel;
Expand Down Expand Up @@ -178,6 +179,7 @@ public void RemoveRange_should_NOT_mutate_collection_when_source_data_is_not_pre
class CollectionWrapper<T>
{
public readonly ObservableRangeCollection<T> Collection = new ObservableRangeCollection<T>();
public ObservableRangeCollection<T> NullCollection;
}

[Fact]
Expand All @@ -192,5 +194,19 @@ public void AddCollection()

Assert.Equal(toAdd, wrapper.Collection);
}

[Fact]
public void AddToNullCollection()
{
var toAdd = new[] { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3 };

Assert.Throws<ArgumentNullException>(() =>
{
var wrapper = new CollectionWrapper<int>()
{
NullCollection = { toAdd }
};
});
}
}
}

0 comments on commit 83e35db

Please sign in to comment.