public RemoveAsync ( string surveyId, string fileName ) : System.Threading.Tasks.Task | ||
surveyId | string | |
fileName | string | |
리턴 | System.Threading.Tasks.Task |
public Task RemoveAsync(string surveyId, string fileName)
{
if (string.IsNullOrEmpty(surveyId))
{
throw new ArgumentNullException("surveyId");
}
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
return
Client.DeleteAsync(MediaFilesApi(surveyId, fileName).AbsoluteUri)
.FlattenExceptions();
}
public void TestRemoveAsync_Always_DoesNotThrow() { const string surveyId = "SurveyId"; const string fileName = "MyFileName"; var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient .Setup(client => client.DeleteAsync(ServiceAddress + "Surveys/" + surveyId + "/MediaFiles/?fileName=" + fileName)) .Returns(CreateTask(HttpStatusCode.OK)); var target = new NfieldMediaFilesService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); target.RemoveAsync(surveyId, fileName).Wait(); }