Example #1
0
        public void InstantiateClient_SimplifiedParameters_ShouldNotBeNullAndShouldAuthorize()
        {
            //Assemble
            OAuth2Token token = TestHelper.GetTestAuthToken();
            Mock <IAsyncHttpClientHelper> httpClient = TestHelper.CreateMockHttpAuthorization(token);

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

            // Assert
            client.ShouldNotBeNull();
            client.ValidateLastGoodTokenIsEqual(token).ShouldBeTrue("last good token does not match expected result");
        }
        public void IntegrationTest_TrackViaClient_CompletePasswordAuthorization()
        {
            TestHelper.EnsureProductionValuesBeforeRunningIntegrationTests();

            // Assemble

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

            // Assert
            client.ShouldNotBeNull();
            client.ValidateLastGoodTokenHasNotExpired(DateTime.Now).ShouldBeTrue("last good token should still be valid");
            client.ValidateAccessTokenIsPresent().ShouldBeTrue("access token is not present");
        }
Example #3
0
        public void InstantiateClient_ExpandedParameters_ShouldNotBeNull()
        {
            //Assemble
            string      baseUriPath = "/openapi";
            Scheme      scheme      = Scheme.https;
            int         port        = 80;
            OAuth2Token token       = TestHelper.GetTestAuthToken();
            Mock <IAsyncHttpClientHelper> httpClient = TestHelper.CreateMockHttpAuthorization(token);

            // Act
            TrackViaClient client = new TrackViaClient(httpClient.Object, baseUriPath, scheme, TestHelper.HostName_Fake, port,
                                                       TestHelper.Username_Fake, TestHelper.ApiKey_Fake, TestHelper.ApiKey_Fake);

            // Assert
            client.ShouldNotBeNull();
        }