Inheritance: ObservableObject, IMessage
        public void FileChooserCallbackHandler_Save_ValueAndEnvironmentModel_ThrowsNotImplementedException()
        {
            //------------Setup for test--------------------------
            var message = new FileChooserMessage();
            var handler = new FileChooserCallbackHandler(message);

            //------------Execute Test---------------------------
            handler.Save("aaa", new Mock<IEnvironmentModel>().Object);

            //------------Assert Results-------------------------
        }
        public void FileChooserCallbackHandler_Save_ValueIsEmpty_ClearsMessageSelectedFiles()
        {
            //------------Setup for test--------------------------
            var message = new FileChooserMessage { SelectedFiles = new[] { "E:\\Data\\tasks1.txt", "E:\\Data\\tasks2.txt" } };
            var handler = new FileChooserCallbackHandler(message);

            //------------Execute Test---------------------------
            handler.Save(string.Empty);

            //------------Assert Results-------------------------
            Assert.IsNull(message.SelectedFiles);
        }
        public void FileChooserCallbackHandler_Save_ValueIsNotNull_UpdatesMessageSelectedFiles()
        {
            //------------Setup for test--------------------------
            var message = new FileChooserMessage();
            var handler = new FileChooserCallbackHandler(message);

            //------------Execute Test---------------------------
            handler.Save("\"{'filePaths':['E:\\\\\\\\Data\\\\\\\\tasks1.txt','E:\\\\\\\\Data\\\\\\\\tasks2.txt']}\"");

            //------------Assert Results-------------------------
            Assert.IsNotNull(message.SelectedFiles);

            var selectedFiles = message.SelectedFiles.ToList();
            Assert.AreEqual(2, selectedFiles.Count);
            Assert.AreEqual("E:\\Data\\tasks1.txt", selectedFiles[0]);
            Assert.AreEqual("E:\\Data\\tasks2.txt", selectedFiles[1]);
        }
        public static void ShowFileChooser(IEnvironmentModel environment, FileChooserMessage fileChooserMessage)
        {
            VerifyArgument.IsNotNull("environment", environment);

            const string PageName = "dialogs/filechooser";
            const double Width = 704;
            const double Height = 517;
            const string LeftTitle = "Choose File(s)";
            var environmentConnection = environment.Connection;
            if(environmentConnection != null)
            {
                string rightTitle = environment.Name + " (" + environmentConnection.AppServerUri + ")";

            var pageHandler = new FileChooserCallbackHandler(fileChooserMessage);

                var envirDisplayName = FullyEncodeServerDetails(environmentConnection);
                var relativeUriString = string.Format("{0}?envir={1}", PageName, envirDisplayName);
                if(!IsTestMode)
                {
                    environment.ShowWebPageDialog(SiteName, relativeUriString, pageHandler, Width, Height, LeftTitle, rightTitle);
                }
                else
                {
                    CallBackHandler = pageHandler;
                    TestModeRelativeUri = relativeUriString;
                }
            }
        }
        public void FileChooserCallbackHandler_Save_ValueIsAnyStringAndCloseWindowIsFalse_DoesNotInvokeClose()
        {
            //------------Setup for test--------------------------
            var message = new FileChooserMessage { SelectedFiles = new[] { "E:\\Data\\tasks1.txt", "E:\\Data\\tasks2.txt" } };
            var handler = new TestFileChooserCallbackHandler(message);

            //------------Execute Test---------------------------
            handler.Save(It.IsAny<string>(), false);

            //------------Assert Results-------------------------
            Assert.AreEqual(0, handler.CloseHitCount);
        }
 public TestFileChooserCallbackHandler(FileChooserMessage message)
     : base(message)
 {
 }
 public FileChooserCallbackHandler(FileChooserMessage fileChooserMessage, IEventAggregator eventPublisher, IEnvironmentRepository currentEnvironmentRepository)
     : base(eventPublisher, currentEnvironmentRepository)
 {
     _fileChooserMessage = fileChooserMessage;
     VerifyArgument.IsNotNull("fileChooserMessage", fileChooserMessage);
 }
 public FileChooserCallbackHandler(FileChooserMessage fileChooserMessage)
     : this(fileChooserMessage, EventPublishers.Aggregator, EnvironmentRepository.Instance)
 {
 }