UpdateAsync() 공개 메소드

See INfieldSurveyRelocationsService.UpdateAsync
public UpdateAsync ( string surveyId, SurveyRelocation relocation ) : System.Threading.Tasks.Task
surveyId string
relocation Nfield.Models.SurveyRelocation
리턴 System.Threading.Tasks.Task
        public void TestPutAsync_Always_CallsCorrectURI()
        {
            var relocation = new SurveyRelocation { Reason = "reason X", Url = "url X" };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(client => client.PutAsJsonAsync(It.IsAny<string>(), It.IsAny<SurveyRelocation>()))
                .Returns(CreateTask(HttpStatusCode.OK,
                    new StringContent(JsonConvert.SerializeObject(It.IsAny<SurveyRelocation>()))));

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

            target.UpdateAsync(SurveyId, relocation).Wait();

            mockedHttpClient
                .Verify(
                    client =>
                        client.PutAsJsonAsync(ServiceAddress + "Surveys/" + SurveyId + "/Relocations", It.IsAny<SurveyRelocation>()),
                    Times.Once());
        }
 public void TestUpdateAsync_SurveyIdIsNull_Throws()
 {
     var target = new NfieldSurveyRelocationsService();
     Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.UpdateAsync(null, new SurveyRelocation())));
 }
        public void TestUpdateAsync_ServerAcceptsRelocations_ReturnsOk()
        {
            var relocation = new SurveyRelocation {Reason = "reason X", Url = "url X"};
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            var content = new StringContent(JsonConvert.SerializeObject(relocation));
            mockedHttpClient
                .Setup(
                    client => client.PutAsJsonAsync(ServiceAddress + "Surveys/" + SurveyId + "/Relocations", relocation))
                .Returns(CreateTask(HttpStatusCode.OK, content));

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

            Assert.DoesNotThrow(() => target.UpdateAsync(SurveyId, relocation).Wait());
        }