Exemplo n.º 1
0
        internal new FileSystemDialogResult Show()
        {
            var result = new FileSystemDialogResult();

            if (parent is Window)
            {
                Owner = parent as Window;
                WindowStartupLocation = WindowStartupLocation.CenterOwner;
            }

            if (ShowDialog() == true)
            {
                result.FullPath = BuildFullPath();
                result.Success  = true;
            }

            return(result);
        }
        public void Operations_MustAbortAskingForApplicationPath()
        {
            var args   = new ApplicationNotFoundEventArgs(default(string), default(string));
            var result = new FileSystemDialogResult {
                Success = false
            };

            fileSystemDialog.Setup(d => d.Show(
                                       It.IsAny <FileSystemElement>(),
                                       It.IsAny <FileSystemOperation>(),
                                       It.IsAny <string>(),
                                       It.IsAny <string>(),
                                       It.IsAny <string>(),
                                       It.IsAny <IWindow>())).Returns(result);
            text.SetReturnsDefault(string.Empty);

            sut.TryStart();
            operationSequence.Raise(s => s.ActionRequired += null, args);

            Assert.IsNull(args.CustomPath);
            Assert.IsFalse(args.Success);
        }
        public void Operations_MustAskForApplicationPath()
        {
            var args   = new ApplicationNotFoundEventArgs(default(string), default(string));
            var result = new FileSystemDialogResult {
                FullPath = @"C:\Some\random\path\", Success = true
            };

            fileSystemDialog.Setup(d => d.Show(
                                       It.IsAny <FileSystemElement>(),
                                       It.IsAny <FileSystemOperation>(),
                                       It.IsAny <string>(),
                                       It.IsAny <string>(),
                                       It.IsAny <string>(),
                                       It.IsAny <IWindow>())).Returns(result);
            text.SetReturnsDefault(string.Empty);

            sut.TryStart();
            operationSequence.Raise(s => s.ActionRequired += null, args);

            Assert.AreEqual(result.FullPath, args.CustomPath);
            Assert.IsTrue(args.Success);
        }