public void RecordFileUpload(string url)
{
Action function = () =>
{
IMS_FSSHTTP_FSSHTTPBManagedCodeSUTControlAdapter sutAdapter = this.site.GetAdapter<IMS_FSSHTTP_FSSHTTPBManagedCodeSUTControlAdapter>();
string fileUrl = url.Substring(0, url.LastIndexOf("/", StringComparison.OrdinalIgnoreCase));
string fileName = url.Substring(url.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1);
try
{
if (!sutAdapter.RemoveFile(fileUrl, fileName))
{
this.errorMessage.Add(string.Format("Cannot remove a file in the URL {0}", url));
this.isEnvironmentRollbackSuccess = false;
}
}
catch (Microsoft.VisualStudio.TestTools.UnitTesting.AssertInconclusiveException e)
{
// Here try to catch the exception to avoid the removing file failure due to the server cannot release the lock as expected.
this.errorMessage.Add(e.Message);
this.isEnvironmentRollbackSuccess = false;
}
};
this.AddOrUpdate(url, function, KeyStatus.UploadTextFile);
}