SamplingPointImageGetAsync() public méthode

public SamplingPointImageGetAsync ( string surveyId, string samplingPointId ) : Task
surveyId string
samplingPointId string
Résultat Task
        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);
        }