SamplingPointUpdateAsync() 공개 메소드

See INfieldSurveysService.SamplingPointUpdateAsync
public SamplingPointUpdateAsync ( string surveyId, Nfield.Models.SamplingPoint samplingPoint ) : Task
surveyId string
samplingPoint Nfield.Models.SamplingPoint
리턴 Task
        public void TestSamplingPointUpdateAsync_SamplingPointExists_ReturnsSamplingPoint()
        {
            const string surveyId = "SurveyId";
            const string samplingPointId = "SamplingPointId";
            const string samplingPointGroupId = "MyGroupId";

            var samplingPoint = new SamplingPoint
            {
                SamplingPointId = samplingPointId,
                Name = "Updated",
                GroupId = samplingPointGroupId
            };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(
                    client =>
                        client.PatchAsJsonAsync<UpdateSamplingPoint>(
                            string.Format("{0}surveys/{1}/samplingpoints/{2}", ServiceAddress, surveyId,
                                samplingPointId), It.IsAny<UpdateSamplingPoint>()))
                .Returns(CreateTask(HttpStatusCode.OK,
                    new StringContent(JsonConvert.SerializeObject(samplingPoint))));

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

            var actual = target.SamplingPointUpdateAsync(surveyId, samplingPoint).Result;

            Assert.Equal(samplingPoint.Name, actual.Name);
            Assert.Equal(samplingPoint.GroupId, actual.GroupId);
        }
 public void TestSamplingPointUpdateAsync_SamplingPointArgumentIsNull_ThrowsArgumentNullException()
 {
     var target = new NfieldSurveysService();
     Assert.Throws<ArgumentNullException>(
         () =>
         {
             try
             {
                 target.SamplingPointUpdateAsync("", null).Wait();
             }
             catch (AggregateException ex)
             {
                 throw ex.InnerException;
             }
         }
         );
 }