Beispiel #1
0
        /// <summary>
        /// See <see cref="INfieldSurveyFieldworkService.StopFieldworkAsync"/>
        /// </summary>
        public Task StopFieldworkAsync(string surveyId, StopFieldworkModel model)
        {
            CheckSurveyId(surveyId);

            var uri = string.Format(@"{0}{1}/{2}/{3}", SurveysApi.AbsoluteUri, surveyId, SurveyFieldworkControllerName, "Stop");

            return(Client.PutAsJsonAsync(uri, model).FlattenExceptions());
        }
Beispiel #2
0
        /// <summary>
        /// See <see cref="INfieldSurveyFieldworkService.StopFieldworkAsync"/>
        /// </summary>
        public Task StopFieldworkAsync(string surveyId, StopFieldworkModel model)
        {
            CheckSurveyId(surveyId);

            var uri = new Uri(SurveysApi, $"{surveyId}/{SurveyFieldworkControllerName}/Stop");

            return(Client.PutAsJsonAsync(uri, model).FlattenExceptions());
        }
        public void TestStopFieldworkAsync_Always_CallsCorrectURI()
        {
            const string surveyId = "SurveyId";
            var          model    = new StopFieldworkModel();

            _mockedHttpClient.Setup(c => c.PutAsJsonAsync(It.IsAny <string>(), model))
            .Returns(CreateTask(HttpStatusCode.OK, new StringContent(string.Empty)));

            _target.StopFieldworkAsync(surveyId, model);

            _mockedHttpClient
            .Verify(client => client.PutAsJsonAsync(ServiceAddress + "surveys/" + surveyId + "/Fieldwork/Stop", model), Times.Once());
        }