public SamplingPointImageAddAsync ( string surveyId, string samplingPointId, string filePath ) : Task |
||
surveyId | string | |
samplingPointId | string | |
filePath | string | |
return | Task |
public void TestSamplingPointImageAddAsync_ServerAcceptsSamplingPointImage_ReturnsFilename() { const string surveyId = "SurveyId"; const string samplingPointId = "SamplingPointId"; const string fileName = "1.jpg"; string filePath = Path.Combine(Directory.GetCurrentDirectory(), "Resources", fileName); var content = new ByteArrayContent(File.ReadAllBytes(filePath)); var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient.Setup(client => client.PostAsync(It.IsAny<string>(), It.IsAny<ByteArrayContent>())) .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(fileName)))); var target = new NfieldSurveysService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var result = target.SamplingPointImageAddAsync(surveyId, samplingPointId, filePath).Result; Assert.Equal(fileName, result); }