mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 20:45:51 +00:00
Make readonly collections truly readonly
These methods actually returned mutable collections that happen to implement the readonly interfaces. User could cast them to the actual type and add things. I'd rather avoid even that possibility by making these truly return readonly stuff.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Octokit;
|
||||
using Xunit;
|
||||
|
||||
public class SearchCodeRequestTests
|
||||
{
|
||||
public class TheMergedQualifiersMethod
|
||||
{
|
||||
[Fact]
|
||||
public void ReturnsAReadOnlyDictionary()
|
||||
{
|
||||
var request = new SearchCodeRequest("test");
|
||||
|
||||
var result = request.MergedQualifiers();
|
||||
|
||||
// If I can cast this to a writeable collection, then that defeats the purpose of a read only.
|
||||
Assert.Null(result as ICollection<string>);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user