public void GetCustomer() { string token; var mockWebClient = TokenandWebClientSetup(out token); //var mockWebClient = TokenandWebClientSetupRemoteCall(out token); mockWebClient.Setup(x => x.DownloadString(new Uri(BaseUri, "patients/15/payments"))) .Returns("{\"PaymentProfile\":[{\"CardNumber\":\"4111111111111111\", \"ExpiryMonth\":\"12\", \"ExpiryYear\":\"2015\" }]}"); var target = new PaymentsApi(Settings.Default.BaseUrl, token, 1, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object); var actual = target.GetCustomerProfile(15); Assert.False(target.NotFound); Assert.False(target.ServerError); Assert.NotNull(actual); //Assert.AreEqual(actual.PaymentProfiles[0].CardNumber.Value, "XXXX1111"); }
public void GetCustomer() { string token; var mockWebClient = TokenandWebClientSetup(out token); //var mockWebClient = TokenandWebClientSetupRemoteCall(out token); mockWebClient.Setup(x => x.DownloadString(new Uri(BaseUri, "v2/patients/15/payments"))) .Returns("{\"$id\": \"1\",\"data\": [{\"$id\": \"2\", \"billingAddress\":{\"street\":\"555 Pine St.\"}, \"description\":\"\", \"Email\":\"[email protected]\"}]}"); var target = new PaymentsApi(Settings.Default.BaseUrl, token, 1, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object); var actual = target.GetCustomerProfile(15); Assert.False(target.NotFound); Assert.False(target.ServerError); Assert.NotNull(actual.Data.FirstOrDefault()); //Assert.AreEqual(actual.PaymentProfiles[0].CardNumber.Value, "XXXX1111"); }