public void SetCollectionAdapter_UnionWith_Succeeds() { List <int> backingList = new List <int>() { 12, 13, 14 }; SetCollectionAdapter <int> adapter = new SetCollectionAdapter <int>(backingList); adapter.UnionWith(new int[] { 7, 13, 8, 12, 13, 15 }); CollectionAssert.AreEquivalent(new int[] { 7, 8, 12, 13, 14, 15 }, backingList); }
public void SetCollectionAdapter_UnionWith_Null_ThrowsArgumentNull() { List <int> backingList = new List <int>() { 12, 13, 14 }; SetCollectionAdapter <int> adapter = new SetCollectionAdapter <int>(backingList); Assert.ThrowsException <ArgumentNullException>( #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. () => adapter.UnionWith(null)); #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. }
public void SetCollectionAdapter_UnionWith_IsReadOnly_ThrowsNotSupported() { ICollection <int> backingList = new ReadOnlyCollection <int>(new List <int>() { 12, 13, 14 }); SetCollectionAdapter <int> adapter = new SetCollectionAdapter <int>(backingList); NotSupportedException e = Assert.ThrowsException <NotSupportedException>( () => adapter.UnionWith(new int[] { 7, 13, 15 })); Assert.AreEqual( ExceptionMessages.CollectionIsReadOnly, e.Message); }