added tests to catch regression

This commit is contained in:
Brendan Forster
2014-04-30 14:52:37 +08:00
parent 81fc84b962
commit c600ce832c
4 changed files with 43 additions and 3 deletions
@@ -22,6 +22,19 @@ namespace Octokit.Tests.Helpers
Assert.Equal(new Uri("https://example.com?foo=foo%20val&bar=barval"), uriWithParameters);
}
[Fact]
public void ThrowsExceptionWhenNullValueProvided()
{
var uri = new Uri("https://example.com");
var parameters = new Dictionary<string, string>
{
{"foo", null },
};
Assert.Throws<ArgumentNullException>(() => uri.ApplyParameters(parameters));
}
[Fact]
public void AppendsParametersAsQueryStringToRelativeUri()
{
+10 -1
View File
@@ -1,4 +1,5 @@
using Octokit;
using System;
using Octokit;
using Octokit.Tests.Helpers;
using Xunit;
@@ -16,5 +17,13 @@ public class SearchCodeRequestTests
// 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"));
}
}
}
@@ -1,4 +1,5 @@
using Octokit;
using System;
using Octokit;
using Octokit.Tests.Helpers;
using Xunit;
@@ -16,5 +17,13 @@ internal class SearchIssuesRequestTests
// 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 SearchIssuesRequest("test");
Assert.True(String.IsNullOrWhiteSpace(request.Sort));
Assert.False(request.Parameters.ContainsKey("sort"));
}
}
}
@@ -1,4 +1,5 @@
using Octokit;
using System;
using Octokit;
using Octokit.Tests.Helpers;
using Xunit;
@@ -16,5 +17,13 @@ internal class SearchUsersRequestTests
// 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 SearchUsersRequest("shiftkey");
Assert.True(String.IsNullOrWhiteSpace(request.Sort));
Assert.False(request.Parameters.ContainsKey("sort"));
}
}
}