public AddAsync ( string surveyId, string samplingPointId, |
||
surveyId | string | |
samplingPointId | string | |
address | ||
리턴 | Task |
public void TestAddAsync_ServerAcceptsAddress_ReturnsAddress() { var address = new Address { Details = "Language X" }; var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); var content = new StringContent(JsonConvert.SerializeObject(address)); mockedHttpClient .Setup(client => client.PostAsJsonAsync(ServiceAddress + "Surveys/" + SurveyId + "/SamplingPoints/" + SamplingPointId + "/Addresses", address)) .Returns(CreateTask(HttpStatusCode.OK, content)); var target = new NfieldAddressesService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var actual = target.AddAsync(SurveyId, SamplingPointId, address).Result; Assert.Equal(address.Details, actual.Details); }
public void TestAddAsync_SurveyIdIsNull_Throws() { var target = new NfieldAddressesService(); Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.AddAsync(null, SamplingPointId, new Address()))); }