Skip to content

Commit

Permalink
added tests for null arguments to AsReadOnly extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrxx99 authored and eiriktsarpalis committed Nov 22, 2021
1 parent a72b3f9 commit 090374e
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,19 @@ public void AsReadOnly_TurnsIDictionaryIntoReadOnlyDictionary()
Assert.Equal(dictionary["key2"], readOnlyDictionary["key2"]);
Assert.Equal(dictionary.Count, readOnlyDictionary.Count);
}

[Fact]
public void AsReadOnly_NullIList_ThrowsArgumentNullException()
{
IList<string> list = null;
Assert.Throws<ArgumentNullException>(() => list.AsReadOnly());
}

[Fact]
public void AsReadOnly_NullIDictionary_ThrowsArgumentNullException()
{
IDictionary<string, string> dictionary = null;
Assert.Throws<ArgumentNullException>(() => dictionary.AsReadOnly());
}
}
}

0 comments on commit 090374e

Please sign in to comment.