public void IntegrationTest_TrackViaClient_GetDomainRecord_SimpleCrmAccount()
        {
            TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests(IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW <= 0 ||
                                                                           IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW_VALIDACCOUNTRECORDID <= 0);

            // Assemble
            TrackViaClient client = new TrackViaClient(IntegrationTestConfig.TRACKVIA_HOSTNAME, IntegrationTestConfig.TRACKVIA_USERNAME,
                                                       IntegrationTestConfig.TRACKVIA_PASSWORD, IntegrationTestConfig.TRACKVIA_API_KEY);

            // Act
            DomainRecord <TestData.SimpleCrmContact> record = client.getRecord <TestData.SimpleCrmContact>(
                IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW,
                IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW_VALIDACCOUNTRECORDID);

            // Assert
            record.ShouldNotBeNull();
            record.Data.ShouldNotBeNull();
            record.Data.Id.ShouldEqual(IntegrationTestConfig.TRACKVIA_VIEWID_DEMOSIMPLECRM_ACCOUNTSDEFAULTVIEW_VALIDACCOUNTRECORDID);
        }
Exemple #2
0
        public void TrackViaClient_GetRecordAsDomainClass_ShouldReturnRecordAsType()
        {
            // Assemble
            Record record = TestData.getUnitTestRecord1();

            Mock <IAsyncHttpClientHelper> httpClient = new Mock <IAsyncHttpClientHelper>();

            TestHelper.HttpClient_SetupGetRequest(HttpStatusCode.OK, record, httpClient);

            TrackViaClient client = new TrackViaClient(httpClient.Object, TestHelper.HostName_Fake, TestHelper.ApiKey_Fake);

            // Act
            DomainRecord <TestData.Contact> contactRecord = client.getRecord <TestData.Contact>(1, 1);

            // Assert
            contactRecord.ShouldNotBeNull();
            contactRecord.Data.ShouldNotBeNull();
            contactRecord.Data.Id.ShouldEqual(record.Data.Id);
        }
Exemple #3
0
        public void TrackViaClient_UpdateRecordAsDomainClass_ShouldUpdateRecordAndReturn()
        {
            // Assemble
            RecordSet rs = TestData.getUnitTestRecordSet3();

            Mock <IAsyncHttpClientHelper> httpClient = new Mock <IAsyncHttpClientHelper>();

            TestHelper.HttpClient_SetupPutJsonRequest(HttpStatusCode.OK, rs, httpClient);

            TrackViaClient client = new TrackViaClient(httpClient.Object, TestHelper.HostName_Fake, TestHelper.ApiKey_Fake);

            TestData.Contact contact = TestData.getUnitTestContact1();

            // Act
            DomainRecord <TestData.Contact> responseRecord = client.updateRecord <TestData.Contact>(1L, contact.Id, contact);

            // Assert
            responseRecord.ShouldNotBeNull();
            responseRecord.Data.ShouldNotBeNull();
            responseRecord.Data.Id.ShouldEqual(contact.Id);
        }