public GetRecentlyUpdatedContacts ( string count = "", string timeOffset = "", string contactOffset = "" ) : System.Json.JsonObject | ||
count | string | |
timeOffset | string | |
contactOffset | string | |
return | System.Json.JsonObject |
public JsonObject GetRecentlyUpdatedContacts(string count = "", string timeOffset = "", string contactOffset = "")
{
var optionalParams = new Dictionary<string, string>();
if (count.Length > 0)
{
optionalParams["count"] = count;
}
if (timeOffset.Length > 0)
{
optionalParams["timeOffset"] = timeOffset;
}
if (count.Length > 0)
{
optionalParams["vidOffset"] = contactOffset;
}
return Call(subpath: "lists/recently_updated/contacts/recent", optionalParams: optionalParams);
}
public void ContactsGetRecentlyUpdatedContactsUrlFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); string expectedUrl = Constants.GetRecentlyUpdatedContactsUrl; // Arrange mockDataSource .Stub(x => x.UploadString( Arg<string>.Is.Anything, // uri Arg<string>.Is.Anything, // method Arg<string>.Is.Anything, // content-type Arg<string>.Is.Anything // data )) .Return(string.Empty); // Act var target = new Contacts(apiKey: Constants.ApiKey) { UserWebClient = mockDataSource }; target.GetRecentlyUpdatedContacts(); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( uri: Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), method: Arg<string>.Is.Anything, contentType: Arg<string>.Is.Anything, data: Arg<string>.Is.Anything)); }