forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchRepositoryRequestTests.cs
More file actions
45 lines (39 loc) · 1.42 KB
/
Copy pathSearchRepositoryRequestTests.cs
File metadata and controls
45 lines (39 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using Octokit;
using Octokit.Tests.Helpers;
using Xunit;
public class SearchRepositoryRequestTests
{
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.
AssertEx.IsReadOnlyCollection<string>(result);
}
[Fact]
public void SortNotSpecifiedByDefault()
{
var request = new SearchCodeRequest("test");
Assert.True(string.IsNullOrWhiteSpace(request.Sort));
Assert.False(request.Parameters.ContainsKey("sort"));
}
[Fact]
public void LanguageUsesParameterTranslation()
{
var request = new SearchRepositoriesRequest() { Language = Language.CPlusPlus };
var result = request.MergedQualifiers();
Assert.Contains(result, x => string.Equals(x, "language:\"cpp\""));
}
[Fact]
public void LicenseUsesParameterTranslation()
{
var request = new SearchRepositoriesRequest() { License = RepoSearchLicense.Apache_2_0 };
var result = request.MergedQualifiers();
Assert.Contains(result, x => string.Equals(x, "license:apache-2.0"));
}
}
}