public void TestDistributeAsync_ValidSurveyResponseCode_CallsCorrectUrl()
        {
            // Arrange
            const string surveyId = "surveyId";
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);

            mockedHttpClient.Setup(client => client.PostAsJsonAsync(It.IsAny<string>(), It.IsAny<SurveyInterviewerDistributeModel>()))
                .Returns(CreateTask(HttpStatusCode.OK));
            var target = new NfieldSurveyInterviewerWorkpackageDistributionService();
            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            // Act
            var model = new SurveyInterviewerDistributeModel();
            target.DistributeAsync(surveyId, model).Wait();

            // Assert
            mockedHttpClient.Verify(hc =>
                    hc.PostAsJsonAsync(
                        It.Is<string>(url => url.EndsWith("Surveys/" + surveyId + "/Distribute/")),
                        It.Is<SurveyInterviewerDistributeModel>(m => m == model)),
                    Times.Once());
        }
 public void TestDistributeAsync_SurveyIdIsNull_Throws()
 {
     var target = new NfieldSurveyInterviewerWorkpackageDistributionService();
     Assert.Throws<ArgumentNullException>(
         () => UnwrapAggregateException(target.DistributeAsync(null, new SurveyInterviewerDistributeModel())));
 }