public async Task QuerySingleNoResults() { ForceClient client = await forceClientFixture.GetForceClient(); SfCase singleCase = await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case WHERE CaseNumber = '999999'"); Assert.True(singleCase == null); }
public async Task QuerySingle() { ForceClient client = await forceClientFixture.GetForceClient(); SfCase singleCase = await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case LIMIT 1"); Assert.False(singleCase == null); Assert.NotNull(singleCase.CaseNumber); }
public async void QuerySingleObjectNoResults() { ForceClient client = CreateMockClient( "https://na15.salesforce.com", "v41.0", "https://na15.salesforce.com/services/data/v41.0/query?q=SELECT%20Id%20FROM%20Case%20WHERE%20CaseNumber%20LIKE%20%270000%25%27", "query_empty_result.json", HttpStatusCode.OK); var c = await client.QuerySingle <SfCase>("SELECT Id FROM Case WHERE CaseNumber LIKE '0000%'"); Assert.Null(c); }
public async void QuerySingleObjectFail() { ForceClient client = CreateMockClient( "https://na15.salesforce.com", "v41.0", "https://na15.salesforce.com/services/data/v41.0/query?q=SELECT%20Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp%20FROM%20Case%20WHERE%20CaseNumber%20LIKE%20%270000%25%27", "query_case_result.json", HttpStatusCode.OK); Exception ex = await Assert.ThrowsAsync <Exception>( async() => await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case WHERE CaseNumber LIKE '0000%'") ); Assert.NotNull(ex); }
public async void QuerySingleObject() { ForceClient client = CreateMockClient( "https://na15.salesforce.com", "v41.0", "https://na15.salesforce.com/services/data/v41.0/query?q=SELECT%20Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp%20FROM%20Case%20WHERE%20CaseNumber%20%3D%20%2700001000%27", "query_case_single_result.json", HttpStatusCode.OK); SfCase singleCase = await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case WHERE CaseNumber = '00001000'"); Assert.False(singleCase == null); Assert.Equal("00001000", singleCase.CaseNumber); Assert.Equal("Edge Communications", singleCase.Account.Name); Assert.Equal("Rose Gonzalez", singleCase.Contact.Name); }
public async void QuerySingleObjectFail() { var mockHandler = new MockHttpClientHandler(); HttpResponseMessage respMsg = MockResponse.GetResponse("query_case_result.json", HttpStatusCode.OK); Uri requestUri = new Uri(@"https://na15.salesforce.com/services/data/v41.0/query?q=SELECT%20Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp%20FROM%20Case%20WHERE%20CaseNumber%20LIKE%20%270000%25%27"); mockHandler.AddMockResponse(requestUri, respMsg); HttpClient httpClient = new HttpClient(mockHandler); ForceClient client = new ForceClient("https://na15.salesforce.com", "v41.0", "dummyToken", httpClient); Exception ex = await Assert.ThrowsAsync <Exception>( async() => await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case WHERE CaseNumber LIKE '0000%'") ); Assert.NotNull(ex); }
public async void QuerySingleObject() { var mockHandler = new MockHttpClientHandler(); HttpResponseMessage respMsg = MockResponse.GetResponse("query_case_single_result.json", HttpStatusCode.OK); Uri requestUri = new Uri(@"https://na15.salesforce.com/services/data/v41.0/query?q=SELECT%20Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp%20FROM%20Case%20WHERE%20CaseNumber%20%3D%20%2700001000%27"); mockHandler.AddMockResponse(requestUri, respMsg); HttpClient httpClient = new HttpClient(mockHandler); ForceClient client = new ForceClient("https://na15.salesforce.com", "v41.0", "dummyToken", httpClient); SfCase singleCase = await client.QuerySingle <SfCase>("SELECT Id,CaseNumber,SystemModstamp,Account.Name,Account.SystemModstamp,Contact.Name,Contact.SystemModstamp FROM Case WHERE CaseNumber = '00001000'"); Assert.False(singleCase == null); Assert.Equal("00001000", singleCase.CaseNumber); Assert.Equal("Edge Communications", singleCase.Account.Name); Assert.Equal("Rose Gonzalez", singleCase.Contact.Name); }