public void RequestsCorrectGetAllStarredUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); client.GetAllStarred(); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/starred")); }
public void RequestsCorrectGetAllStarredWithSinceUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); DateTimeOffset since = DateTimeOffset.Now; client.GetAllStarred(since); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/starred"), Arg.Is<IDictionary<string, string>>(x => x.ContainsKey("since"))); }
public async Task EnsureNonNullArguments() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllStarred(null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllStarred(DateTimeOffset.Now, null)); }
public void RequestsCorrectGetAllStarredWithSinceUrlAndApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; DateTimeOffset since = DateTimeOffset.Now; client.GetAllStarred(since, options); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/starred"), DictionaryWithSince, options); }
public void RequestsCorrectGetAllStarredWithSinceUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); DateTimeOffset since = DateTimeOffset.Now; client.GetAllStarred(since); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/starred"), DictionaryWithSince, Args.ApiOptions); }
public void RequestsCorrectGetAllStarredUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAllStarred(options); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists/starred"), options); }