public void TestSamplingPointImageGetAsync_ServerAcceptsGet_ReturnsFilename() { const string surveyId = "SurveyId"; const string samplingPointId = "SamplingPointId"; const string fileName = "1.jpg"; var getContent = new ByteArrayContent(new byte[] { 1 }); getContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = fileName }; var mockedNfieldConnection = new Mock <INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient.Setup(client => client.GetAsync(It.IsAny <string>())) .Returns(CreateTask(HttpStatusCode.OK, getContent)); var target = new NfieldSurveysService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var result = target.SamplingPointImageGetAsync(surveyId, samplingPointId).Result; Assert.Equal(fileName, result.FileName); }