public void RequestsCorrectGetAllUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); client.GetAll(); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), Args.ApiOptions); }
public void RequestsCorrectGetAllWithSinceUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); DateTimeOffset since = DateTimeOffset.Now; client.GetAll(since); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), Arg.Is<IDictionary<string,string>>(x => x.ContainsKey("since"))); }
public void RequestsCorrectGetAllUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAll(options); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), options); }
public void RequestsCorrectGetAllWithSinceUrlAndApiOptions() { 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.GetAll(since, options); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), DictionaryWithSince, options); }
public void RequestsCorrectGetAllWithSinceUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); DateTimeOffset since = DateTimeOffset.Now; client.GetAll(since); connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), DictionaryWithSince, Args.ApiOptions); }
public async Task EnsureNonNullArguments() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(DateTimeOffset.Now, null)); }