GetSurveyPackageAsync() public méthode

public GetSurveyPackageAsync ( string surveyId, InterviewPackageType interviewPackageType ) : System.Threading.Tasks.Task
surveyId string
interviewPackageType InterviewPackageType
Résultat System.Threading.Tasks.Task
        public void TestGetSurveyPackageAsync_ReturnsSurveyPackage()
        {
            var expectedPackage = new SurveyPackage()
            {
                SurveyName = "SurveyName"
            };

            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);

            mockedHttpClient
                .Setup(client => client.GetAsync(ServiceAddress + "Surveys/" + SurveyId + "/Package/?type=" + InterviewPackageType.Live))
                .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(expectedPackage))));

            var target = new NfieldSurveyPackageService();
            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            var actual = target.GetSurveyPackageAsync(SurveyId, InterviewPackageType.Live).Result;

            Assert.Equal(expectedPackage.SurveyName, actual.SurveyName);
        }
 public void TestGetSurveyPackageAsync_SurveyIdIsNull_Throws()
 {
     var target = new NfieldSurveyPackageService();
     Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.GetSurveyPackageAsync(null, InterviewPackageType.Test)));
 }
 public void TestGetSurveyPackageAsync_PackageTypeIsUnknown_Throws()
 {
     var target = new NfieldSurveyPackageService();
     Assert.Throws<ArgumentException>(() => UnwrapAggregateException(target.GetSurveyPackageAsync("SurveyId", InterviewPackageType.Unknown)));
 }