public static void TestOpenAndLaunchOfAxCryptDocumentArgumentNullException() { FileSystemState nullFileSystemState = null; string nullString = null; AxCryptDocument nullDocument = null; ProgressContext nullProgressContext = null; Assert.Throws <ArgumentNullException>(() => { nullFileSystemState.OpenAndLaunchApplication(_helloWorldAxxPath, new AxCryptDocument(), new ProgressContext()); }); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(nullString, new AxCryptDocument(), new ProgressContext()); }); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(_helloWorldAxxPath, nullDocument, new ProgressContext()); }); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(_helloWorldAxxPath, new AxCryptDocument(), nullProgressContext); }); }
private bool DecryptAndLaunchFileOperation() { try { _eventArgs.Status = _fileSystemState.OpenAndLaunchApplication(_eventArgs.OpenFileFullName, _eventArgs.AxCryptDocument, _progress); } finally { _eventArgs.AxCryptDocument.Dispose(); _eventArgs.AxCryptDocument = null; } _eventArgs.Status = FileOperationStatus.Success; return(true); }
public static void TestInvalidArguments() { FileSystemState nullFileSystemState = null; string file = _helloWorldAxxPath; string nullFile = null; IEnumerable <AesKey> keys = new AesKey[] { new Passphrase("a").DerivedPassphrase }; IEnumerable <AesKey> nullKeys = null; ProgressContext context = new ProgressContext(); ProgressContext nullContext = null; Assert.Throws <ArgumentNullException>(() => { nullFileSystemState.OpenAndLaunchApplication(file, keys, context); }, "The FileSystemState is null."); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(nullFile, keys, context); }, "The file string is null."); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(file, nullKeys, context); }, "The keys are null."); Assert.Throws <ArgumentNullException>(() => { _fileSystemState.OpenAndLaunchApplication(file, keys, nullContext); }, "The context is null."); }