public void TestQueryAsync_ServerReturnsQuery_ReturnsListWithSurveys() { var expectedSurveys = new[] { new Survey(SurveyType.Basic) { SurveyId = "TestSurvey" }, new Survey(SurveyType.Advanced) { SurveyId = "AnotherTestSurvey" } }; var mockedNfieldConnection = new Mock <INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient .Setup(client => client.GetAsync(ServiceAddress + "surveys/")) .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(expectedSurveys)))); var target = new NfieldSurveysService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var actualSurveys = target.QueryAsync().Result; Assert.Equal(expectedSurveys[0].SurveyId, actualSurveys.ToArray()[0].SurveyId); Assert.Equal(expectedSurveys[1].SurveyId, actualSurveys.ToArray()[1].SurveyId); Assert.Equal(2, actualSurveys.Count()); }