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:
Haacked
2014-02-26 18:38:57 -08:00
parent 116dd47ab4
commit 9eb14f3c51
8 changed files with 94 additions and 13 deletions
@@ -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>);
}
}
}