- Code: Select all
[TestMethod]
public void RemoveWordSecurityTest()
{
string strFileName = @".\Password Protected Word.docx";
string strTarget = @".\Password Protected Word Unlocked.docx";
string strPassword = "password";
bool blResult;
try
{
Document document = new Document(strFileName, strPassword);
document.RemoveEncryption();
document.SaveToFile(strTarget);
document.Dispose();
blResult = true;
}
catch (Exception e)
{
blResult = false;
Assert.Fail($"Failed with Exception:\n{e.Message}\n{e.StackTrace}");
}
Assert.IsTrue(blResult, "Security Removal Failed");
}
Let me know if you need anything further to help resolve this issue.
Darren