public GetAllContacts ( string count = "", string property = "", string contactOffset = "" ) : System.Json.JsonObject | ||
count | string | |
property | string | |
contactOffset | string | |
리턴 | System.Json.JsonObject |
public JsonObject GetAllContacts(string count = "", string property = "", string contactOffset = "")
{
var optionalParams = new Dictionary<string, string>();
if (count.Length > 0)
{
optionalParams["count"] = count;
}
if (property.Length > 0)
{
optionalParams["property"] = property;
}
if (count.Length > 0)
{
optionalParams["vidOffset"] = contactOffset;
}
return Call(subpath: "lists/all/contacts/all", optionalParams: optionalParams);
}
public void ContactsGetAllContactsUrlFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); string expectedUrl = Constants.GetAllContactsUrl; // 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.GetAllContacts(); // 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)); }