public void IntegrationTest_TrackViaClient_GetViewListMatchingName()
        {
            TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests(string.IsNullOrWhiteSpace(
                                                                               IntegrationTestConfig.TRACKVIA_VIEWNAME_THATMATCHES_ATLEASTTWOVIEWS));

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

            // Act
            var viewsResult = client.getViews("My Accounts");

            // Assert
            viewsResult.ShouldNotBeNull().ShouldNotBeEmpty();
            viewsResult.Count.ShouldBeGreaterThan(1);
            for (int i = 0; i < viewsResult.Count; i++)
            {
                var viewUnderTest = viewsResult[i];
                viewUnderTest.ShouldNotBeNull();
                viewUnderTest.ApplicationName.ShouldNotBeEmpty();
                viewUnderTest.Id.ShouldNotBeEmpty();
                viewUnderTest.Name.ShouldNotBeEmpty();
                Assert.IsTrue(viewUnderTest.Name.Contains("My Accounts"), "returned view does not contain passed string");
            }
        }
Ejemplo n.º 2
0
        public void TrackViaClient_GetViews_ShouldReturnListOfViews()
        {
            // Assemble
            List <View> views = new List <View>()
            {
                new View("1", "Default Contacts View", "Contact Management - IT"),
                new View("2", "Default Activities View", "Contact Management - IT")
            };

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

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

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

            // Act
            List <View> viewsResponse = client.getViews();

            // Assert
            viewsResponse.ShouldNotBeNull()
            .Count.ShouldEqual(views.Count);
            for (int i = 0; i < views.Count; i++)
            {
                viewsResponse[i].ShouldNotBeNull().ShouldEqual(views[i]);
            }
        }
        public void IntegrationTest_TrackViaClient_GetViewList()
        {
            TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests();

            // Assemble

            // Act
            TrackViaClient client = new TrackViaClient(IntegrationTestConfig.TRACKVIA_HOSTNAME, IntegrationTestConfig.TRACKVIA_USERNAME,
                                                       IntegrationTestConfig.TRACKVIA_PASSWORD, IntegrationTestConfig.TRACKVIA_API_KEY);
            var viewsResult = client.getViews();

            // Assert
            viewsResult.ShouldNotBeNull().ShouldNotBeEmpty();
            viewsResult.Count.ShouldBeGreaterThan(1);
            for (int i = 0; i < viewsResult.Count; i++)
            {
                var viewUnderTest = viewsResult[i];
                viewUnderTest.ShouldNotBeNull();
                viewUnderTest.ApplicationName.ShouldNotBeEmpty();
                viewUnderTest.Id.ShouldNotBeEmpty();
                viewUnderTest.Name.ShouldNotBeEmpty();
            }
        }