public void TestGetSurveyBatchesStatusAsync_SurveyIdIsWhitespace_Throws()
        {
            var target = new NfieldSurveyInviteRespondentsService();

            Assert.Throws <ArgumentException>(() =>
                                              UnwrapAggregateException(target.GetSurveyBatchesStatusAsync("   ")));
        }
        public void TestGetSurveyBatchesStatusAsync_ProvideBatchName_ReturnsData()
        {
            var mockedNfieldConnection = new Mock <INfieldConnectionClient>();
            var mockedHttpClient       = CreateHttpClientMock(mockedNfieldConnection);

            var target = new NfieldSurveyInviteRespondentsService();

            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            var expectedResult = new
            {
                SurveyId          = SurveyId,
                BatchName         = "BatchName",
                Status            = "Status",
                ScheduledFor      = DateTime.UtcNow,
                TotalCount        = 1,
                ScheduledCount    = 2,
                PendingCount      = 3,
                NotSentCount      = 4,
                ErrorCount        = 5,
                SentCount         = 6,
                OpenedCount       = 7,
                ClickedCount      = 8,
                UnsubscribedCount = 9,
                AbuseReportCount  = 10,
                UnknownCount      = 11
            };

            var url = new Uri(ServiceAddress, $"Surveys/{SurveyId}/InviteRespondents/SurveyBatchesStatus/");

            mockedHttpClient.Setup(client => client.GetAsync(url))
            .Returns(CreateTask(HttpStatusCode.OK,
                                new StringContent(JsonConvert.SerializeObject(new[] { expectedResult }))));

            var result = target.GetSurveyBatchesStatusAsync(SurveyId).Result.ToArray();

            Assert.Equal(1, result.Length);
            Assert.Equal(expectedResult.SurveyId, result[0].SurveyId);
            Assert.Equal(expectedResult.BatchName, result[0].BatchName);
            Assert.Equal(expectedResult.Status, result[0].Status);
            Assert.Equal(expectedResult.ScheduledFor, result[0].ScheduledFor);
            Assert.Equal(expectedResult.TotalCount, result[0].TotalCount);
            Assert.Equal(expectedResult.ScheduledCount, result[0].ScheduledCount);
            Assert.Equal(expectedResult.PendingCount, result[0].PendingCount);
            Assert.Equal(expectedResult.NotSentCount, result[0].NotSentCount);
            Assert.Equal(expectedResult.ErrorCount, result[0].ErrorCount);
            Assert.Equal(expectedResult.SentCount, result[0].SentCount);
            Assert.Equal(expectedResult.OpenedCount, result[0].OpenedCount);
            Assert.Equal(expectedResult.ClickedCount, result[0].ClickedCount);
            Assert.Equal(expectedResult.UnsubscribedCount, result[0].UnsubscribedCount);
            Assert.Equal(expectedResult.AbuseReportCount, result[0].AbuseReportCount);
            Assert.Equal(expectedResult.UnknownCount, result[0].UnknownCount);
        }