SamplingPointAddAsync() 공개 메소드

See INfieldSurveysService.SamplingPointAddAsync
public SamplingPointAddAsync ( string surveyId, Nfield.Models.SamplingPoint samplingPoint ) : Task
surveyId string
samplingPoint Nfield.Models.SamplingPoint
리턴 Task
        public void TestSamplingPointAddAsync_ServerAcceptsSamplingPoint_ReturnsSamplingPoint()
        {
            const string samplingPointGroupId = "MyGroupId";
            var office = new FieldworkOffice { OfficeId = "OfficeId" };
            var survey = new Survey(SurveyType.Basic) { SurveyId = "SurveyId" };
            var samplingPoint = new SamplingPoint
            {
                SamplingPointId = "SamplingPointId",
                FieldworkOfficeId = office.OfficeId,
                GroupId = samplingPointGroupId
            };

            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            var content = new StringContent(JsonConvert.SerializeObject(samplingPoint));
            mockedHttpClient
                .Setup(
                    client =>
                        client.PostAsJsonAsync(
                            string.Format("{0}surveys/{1}/samplingpoints", ServiceAddress, survey.SurveyId),
                            samplingPoint))
                .Returns(CreateTask(HttpStatusCode.OK, content));

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

            var actual = target.SamplingPointAddAsync(survey.SurveyId, samplingPoint).Result;

            Assert.Equal(samplingPoint.SamplingPointId, actual.SamplingPointId);
            Assert.Equal(samplingPoint.FieldworkOfficeId, actual.FieldworkOfficeId);
            Assert.Equal(samplingPoint.GroupId, actual.GroupId);
        }