public void ToSettings()
        {
            // Arrange
            dialog.FileName    = "SomeFile.txt";
            dialog.FilterIndex = 2;

            // Act
            sync.ToSettings();

            // Assert
            Assert.That(settings.FileName, Is.EqualTo(dialog.FileName));
            Assert.That(settings.FileNames, Is.EqualTo(dialog.FileNames));
            Assert.That(settings.FilterIndex, Is.EqualTo(dialog.FilterIndex));
        }
        /// <inheritdoc />
        public bool?ShowDialog(Window owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            bool?result = dialog.ShowDialog(owner);

            // Update settings
            sync.ToSettings();

            return(result);
        }
Exemple #3
0
        public void ToSettings()
        {
            // Arrange
            var dialog   = new SaveFileDialog();
            var settings = new SaveFileDialogSettings();
            var sync     = new SaveFileDialogSettingsSync(dialog, settings);

            dialog.FileName    = "SomeFile.txt";
            dialog.FilterIndex = 2;

            // Act
            sync.ToSettings();

            // Assert
            Assert.That(settings.FileName, Is.EqualTo(dialog.FileName));
            Assert.That(settings.FileNames, Is.EqualTo(dialog.FileNames));
            Assert.That(settings.FilterIndex, Is.EqualTo(dialog.FilterIndex));
            Assert.That(settings.SafeFileName, Is.EqualTo(dialog.SafeFileName));
            Assert.That(settings.SafeFileNames, Is.EqualTo(dialog.SafeFileNames));
        }