Exemplo n.º 1
0
        public async Task VoiqClient_RefreshToken()
        {
            Func <Task> asyncFunction = async() =>
            {
                await VoiqClient.LoginAsync();
            };

            asyncFunction.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();

            var expirationTime = VoiqClient.AuthTokens.ExpiresUtc;

            await Task.Delay(10000);

            Func <Task> asyncFunction2 = async() =>
            {
                await VoiqClient.RefreshTokenAsync();
            };

            asyncFunction2.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();
            VoiqClient.AuthTokens.ExpiresUtc.Should().BeAfter(expirationTime);
            VoiqClient.AuthTokens = null;
        }
Exemplo n.º 2
0
        public async Task VoiqClient_GetCampaign_WithEverything_ByDate()
        {
            Func <Task> asyncFunction = async() =>
            {
                await VoiqClient.LoginAsync();
            };

            asyncFunction.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();

            Campaign    campaign       = null;
            Func <Task> asyncFunction2 = async() =>
            {
            };

            asyncFunction2.ShouldNotThrow();
            campaign.Should().NotBeNull();
            campaign.CampaignCallFrequencies.Should().NotBeNull();
            campaign.Leads.Should().NotBeNull().And.NotBeEmpty();
            campaign.Leads.SelectMany(c => c.Calls).Should().NotBeNull().And.NotBeEmpty();
            campaign.Leads.SelectMany(c => c.Calls).Where(c => c.DateCreated.Date == new DateTime(2016, 10, 11).Date).Count().Should().Be(478);
            campaign.Leads.SelectMany(c => c.Calls).Where(c => c.DateCreated.Date == new DateTime(2016, 10, 12).Date).Count().Should().Be(0);
            campaign.Surveys.Should().NotBeNull().And.NotBeEmpty();
            campaign.SurveyResults.Should().NotBeNull().And.NotBeEmpty();
            campaign.SurveyResults.Where(c => c.DateCreated.Date == new DateTime(2016, 10, 11).Date).Count().Should().Be(7);
            campaign.SurveyResults.Where(c => c.DateCreated.Date == new DateTime(2016, 10, 12).Date).Count().Should().Be(0);
        }
Exemplo n.º 3
0
        public async Task VoiqClient_LoginSuccess()
        {
            Func <Task> asyncFunction = async() =>
            {
                await VoiqClient.LoginAsync();
            };

            asyncFunction.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();
            VoiqClient.AuthTokens = null;
        }
Exemplo n.º 4
0
        public async Task VoiqClient_GetAllCampaigns_WithEverything()
        {
            Func <Task> asyncFunction = async() =>
            {
                await VoiqClient.LoginAsync();
            };

            asyncFunction.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();

            List <CampaignSummary> campaigns      = null;
            Func <Task>            asyncFunction2 = async() =>
            {
                campaigns = await VoiqClient.Campaigns.GetAllAsync();
            };

            asyncFunction2.ShouldNotThrow();
            campaigns.Should().NotBeNull().And.NotBeEmpty();
            //campaigns[0].DateEnds.Should().NotBeNull();
            //campaigns[0].DateStarts.Should().NotBeNull();
        }
Exemplo n.º 5
0
        public async Task VoiqClient_GetCampaign_WithEverything()
        {
            Func <Task> asyncFunction = async() =>
            {
                await VoiqClient.LoginAsync();
            };

            asyncFunction.ShouldNotThrow();
            VoiqClient.AuthTokens.Should().NotBeNull();
            VoiqClient.AuthTokens.IsExpired.Should().BeFalse();

            Campaign    campaign       = null;
            Func <Task> asyncFunction2 = async() =>
            {
            };

            asyncFunction2.ShouldNotThrow();
            campaign.Should().NotBeNull();
            campaign.CampaignCallFrequencies.Should().NotBeNull();
            campaign.Leads.Should().NotBeNull().And.NotBeEmpty();
            campaign.Leads.SelectMany(c => c.Calls).Should().NotBeNull().And.NotBeEmpty();
            campaign.SurveyResults.Should().NotBeNull().And.NotBeEmpty();
            campaign.Surveys.Should().NotBeNull().And.NotBeEmpty();
        }