QueryAsync() 공개 메소드

See INfieldAddressesService.QueryAsync
public QueryAsync ( string surveyId, string samplingPointId ) : Task>
surveyId string
samplingPointId string
리턴 Task>
 public void TestQueryAsync_SurveyIdIsNull_Throws()
 {
     var target = new NfieldAddressesService();
     Assert.Throws<ArgumentNullException>(() =>
             UnwrapAggregateException(target.QueryAsync(null, SamplingPointId)));
 }
        public void TestQueryAsync_ServerReturnsQuery_ReturnsListWithAddresses()
        {
            var expectedAddresses = new Address[]
            { new Address{AddressId = "id1", Details = "X"},
              new Address{AddressId = "id2", Details = "Y"}
            };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(client => client.GetAsync(ServiceAddress + "Surveys/" + SurveyId +
                    "/SamplingPoints/" + SamplingPointId + "/Addresses"))
                .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(expectedAddresses))));

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

            var actualAddresses = target.QueryAsync(SurveyId, SamplingPointId).Result;
            Assert.Equal(expectedAddresses[0].AddressId, actualAddresses.ToArray()[0].AddressId);
            Assert.Equal(expectedAddresses[1].AddressId, actualAddresses.ToArray()[1].AddressId);
            Assert.Equal(2, actualAddresses.Count());
        }