RemoveAsync() public method

See INfieldSurveysService.RemoveAsync
public RemoveAsync ( Nfield.Models.Survey survey ) : System.Threading.Tasks.Task
survey Nfield.Models.Survey
return System.Threading.Tasks.Task
コード例 #1
0
 public void TestAddAsync_SurveyIsNull_ThrowsArgumentNullException()
 {
     var target = new NfieldSurveysService();
     Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.RemoveAsync(null)));
 }
コード例 #2
0
        public void TestRemoveAsync_ServerRemovedSurvey_DoesNotThrow()
        {
            const string surveyId = "Survey X";
            var survey = new Survey(SurveyType.Basic) { SurveyId = surveyId };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(client => client.DeleteAsync(ServiceAddress + "surveys/" + surveyId))
                .Returns(CreateTask(HttpStatusCode.OK));

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

            Assert.DoesNotThrow(() => target.RemoveAsync(survey).Wait());
        }