public void TrackViaClient_CreateRecordBatchAsDomainClass_ShouldCreatedRecords() { // Assemble Record rawRecord = TestData.getUnitTestRecord1(); TestData.Contact contact = TestData.getUnitTestContact1(); List <TestData.Contact> contacts = new List <TestData.Contact>(new TestData.Contact[] { contact }); DomainRecordSet <TestData.Contact> rs = new DomainRecordSet <TestData.Contact>(rawRecord.Structure, contacts); Mock <IAsyncHttpClientHelper> httpClient = new Mock <IAsyncHttpClientHelper>(); TestHelper.HttpClient_SetupPostJsonRequest(HttpStatusCode.Created, rs, httpClient); TrackViaClient client = new TrackViaClient(httpClient.Object, TestHelper.HostName_Fake, TestHelper.ApiKey_Fake); DomainRecordDataBatch <TestData.Contact> batch = new DomainRecordDataBatch <TestData.Contact>(contacts); // Act DomainRecordSet <TestData.Contact> rsResponse = client.createRecords <TestData.Contact>(1L, batch); // Assert rsResponse .ShouldNotBeNull() .Count.ShouldEqual(rs.Count); rsResponse.Data .ShouldNotBeNull() .Count.ShouldEqual(rs.Count); }
public void TrackViaClient_CreateRecordBatch_ShouldCreatedRecords() { // Assemble RecordSet rs = TestData.getUnitTestRecordSet3(); RecordDataBatch batch = new RecordDataBatch(rs.Data); Mock <IAsyncHttpClientHelper> httpClient = new Mock <IAsyncHttpClientHelper>(); TestHelper.HttpClient_SetupPostJsonRequest(HttpStatusCode.Created, rs, httpClient); TrackViaClient client = new TrackViaClient(httpClient.Object, TestHelper.HostName_Fake, TestHelper.ApiKey_Fake); // Act RecordSet rsResponse = client.createRecords(1L, batch); // Assert rsResponse .ShouldNotBeNull() .Count.ShouldEqual(rs.Count); rsResponse.Data .ShouldNotBeNull() .Count.ShouldEqual(rs.Count); for (int i = 0; i < rsResponse.Count; i++) { RecordData rd1 = rs.Data[i]; RecordData rd2 = rsResponse.Data[i]; rd2.Id.ShouldEqual(rd1.Id); } }
private static Record Integration_CreateRecordStep(TrackViaClient client) { RecordData recordData = TestData.IntegrationTest_SimpleCrmContact_GetCreateRecordData(); RecordDataBatch rsBatch = new RecordDataBatch(new RecordData[] { recordData }); // Act RecordSet rsResponse = client.createRecords(IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW, rsBatch); // Assert rsResponse.ShouldNotBeNull(); rsResponse.Count.ShouldEqual(1); rsResponse.Data.ShouldNotBeNull(); rsResponse.Data[0].Id.ShouldBeGreaterThan(0); rsResponse.Data[0].ShouldNotBeNull(); return(new Record(rsResponse.Structure, rsResponse.Data[0])); }
public void IntegrationTest_TrackViaClient_CreateRecords_SimpleCRMAccount() { TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests(); // Assemble RecordData recordData = TestData.IntegrationTest_SimpleCrmContact_GetCreateRecordData(); RecordDataBatch rsBatch = new RecordDataBatch(new RecordData[] { recordData }); TrackViaClient client = new TrackViaClient(IntegrationTestConfig.TRACKVIA_HOSTNAME, IntegrationTestConfig.TRACKVIA_USERNAME, IntegrationTestConfig.TRACKVIA_PASSWORD, IntegrationTestConfig.TRACKVIA_API_KEY); // Act RecordSet rsResponse = client.createRecords(IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW, rsBatch); // Assert rsResponse.ShouldNotBeNull(); rsResponse.Data.ShouldNotBeNull(); rsResponse.Count.ShouldEqual(1); rsResponse.Data[0].ShouldNotBeNull(); }
public void IntegrationTest_TrackViaClient_CreateDomainRecords_SimpleCrmAccounts() { TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests(IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW <= 0); // Assemble TrackViaClient client = new TrackViaClient(IntegrationTestConfig.TRACKVIA_HOSTNAME, IntegrationTestConfig.TRACKVIA_USERNAME, IntegrationTestConfig.TRACKVIA_PASSWORD, IntegrationTestConfig.TRACKVIA_API_KEY); TestData.SimpleCrmContact contact = TestData.IntegrationTest_SimpleCrmContact_GetCreate(); DomainRecordDataBatch <TestData.SimpleCrmContact> batch = new DomainRecordDataBatch <TestData.SimpleCrmContact>(new TestData.SimpleCrmContact[] { contact }); // Act DomainRecordSet <TestData.SimpleCrmContact> domainRecordSet = client.createRecords <TestData.SimpleCrmContact>( IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW, batch); // Assert domainRecordSet.ShouldNotBeNull() .Data.ShouldNotBeNull().ShouldNotBeEmpty(); domainRecordSet.Count.ShouldEqual(1); domainRecordSet.Data.Count.ShouldEqual(domainRecordSet.Count); for (int i = 0; i < domainRecordSet.Count; i++) { TestData.SimpleCrmContact Account = domainRecordSet.Data[i]; Account.ShouldNotBeNull(); Account.Id.ShouldBeGreaterThan(0); Account.AccountName.ShouldNotBeNull().ShouldEqual(contact.AccountName); Account.PrimaryContact.ShouldNotBeNull().ShouldEqual(contact.PrimaryContact); Account.ContactPhone.ShouldNotBeNull().ShouldEqual(contact.ContactPhone); Account.ContactEmail.ShouldNotBeNull().ShouldEqual(contact.ContactEmail); Account.Address.ShouldNotBeNull().ShouldEqual(contact.Address); Account.City.ShouldNotBeNull().ShouldEqual(contact.City); Account.State.ShouldNotBeNull().ShouldEqual(contact.State); Account.ZipCode.ShouldNotBeNull().ShouldEqual(contact.ZipCode); } }