Inheritance: WebsiteCallbackHandler
        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_Constructor_FileChooserMessageIsNull_ThrowsArgumentNullException()
        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            #pragma warning disable 168
            var handler = new FileChooserCallbackHandler(null);
            #pragma warning restore 168

            //------------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]);
        }
Ejemplo n.º 5
0
        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;
                }
            }
        }