Пример #1
0
        public void Rc40BitEncryptionEnabled_RaisePropertyChanged()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            var eventStub = MockRepository.GenerateStub <IEventHandler <PropertyChangedEventArgs> >();

            pdfTabViewModel.PropertyChanged += eventStub.OnEventRaised;

            var lowEncryptionEnabledPropertyListener              = new PropertyChangedListenerMock(pdfTabViewModel, "LowEncryptionEnabled");
            var mediumEncryptionEnabledPropertyListener           = new PropertyChangedListenerMock(pdfTabViewModel, "MediumEncryptionEnabled");
            var highEncryptionEnabledPropertyListener             = new PropertyChangedListenerMock(pdfTabViewModel, "HighEncryptionEnabled");
            var extendedPermissonsEnabledPropertyListener         = new PropertyChangedListenerMock(pdfTabViewModel, "ExtendedPermissonsEnabled");
            var restrictLowQualityPrintingEnabledPropertyListener = new PropertyChangedListenerMock(pdfTabViewModel, "RestrictLowQualityPrintingEnabled");
            var allowFillFormsEnabledPropertyListener             = new PropertyChangedListenerMock(pdfTabViewModel, "AllowFillFormsEnabled");
            var allowScreenReadersEnabledPropertyListener         = new PropertyChangedListenerMock(pdfTabViewModel, "AllowScreenReadersEnabled");
            var allowEditingAssemblyEnabledPropertyListener       = new PropertyChangedListenerMock(pdfTabViewModel, "AllowEditingAssemblyEnabled");
            var pdfVersionPropertyListener = new PropertyChangedListenerMock(pdfTabViewModel, "PdfVersion");

            pdfTabViewModel.LowEncryptionEnabled = true;

            Assert.IsTrue(lowEncryptionEnabledPropertyListener.WasCalled, "RaisePropertyChanged for LowEncryptionEnabled was not called");
            Assert.IsTrue(mediumEncryptionEnabledPropertyListener.WasCalled, "RaisePropertyChanged for MediumEncryptionEnabled was not called");
            Assert.IsTrue(highEncryptionEnabledPropertyListener.WasCalled, "RaisePropertyChanged for HighEncryptionEnabled was not called");
            Assert.IsTrue(extendedPermissonsEnabledPropertyListener.WasCalled, "RaisePropertyChanged for Settings was not called");
            Assert.IsTrue(restrictLowQualityPrintingEnabledPropertyListener.WasCalled, "RaisePropertyChanged for Settings was not called");
            Assert.IsTrue(allowFillFormsEnabledPropertyListener.WasCalled, "RaisePropertyChanged for Settings was not called");
            Assert.IsTrue(allowScreenReadersEnabledPropertyListener.WasCalled, "RaisePropertyChanged for Settings was not called");
            Assert.IsTrue(allowEditingAssemblyEnabledPropertyListener.WasCalled, "RaisePropertyChanged for Settings was not called");
            Assert.IsTrue(pdfVersionPropertyListener.WasCalled, "RaisePropertyChanged for PdfVersion was not called");
        }
Пример #2
0
        public void Aes128BitEncryption_CheckExtendedPermissionValues()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.EncryptionLevel = EncryptionLevel.Rc128Bit;

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.RestrictPrintingToLowQuality = true;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowToFillForms             = true;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowScreenReader            = true;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowToEditAssembly          = true;
            Assert.IsTrue(pdfTabViewModel.RestrictLowQualityPrintingEnabled,
                          "Enabled RestrictLowQualityPrintingEnabled is false for 128BitAes encryption");
            Assert.IsTrue(pdfTabViewModel.AllowFillFormsEnabled,
                          "Enabled AllowFillFormsEnabled is false for 128BitAes encryption");
            Assert.IsTrue(pdfTabViewModel.AllowScreenReadersEnabled,
                          "Enabled AllowScreenReadersEnabled is false for 128BitAes encryption");
            Assert.IsTrue(pdfTabViewModel.AllowEditingAssemblyEnabled,
                          "Enabled AllowEditingAssemblyEnabled is false for 128BitAes encryption");

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.RestrictPrintingToLowQuality = false;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowToFillForms             = false;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowScreenReader            = false;
            pdfTabViewModel.CurrentProfile.PdfSettings.Security.AllowToEditAssembly          = false;
            Assert.IsFalse(pdfTabViewModel.RestrictLowQualityPrintingEnabled,
                           "Disabled RestrictLowQualityPrintingEnabled is true for 128BitAes encryption");
            Assert.IsFalse(pdfTabViewModel.AllowFillFormsEnabled,
                           "Disabled  AllowFillFormsEnabled is true for 128BitAes encryption");
            Assert.IsFalse(pdfTabViewModel.AllowScreenReadersEnabled,
                           "Disabled  AllowScreenReadersEnabled is true for 128BitAes encryption");
            Assert.IsFalse(pdfTabViewModel.AllowEditingAssemblyEnabled,
                           "Disabled AllowEditingAssemblyEnabled is true for 128BitAes encryption");
        }
Пример #3
0
        public void Aes128BitEncryption_ExtendedPermissionsEnabled()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.EncryptionLevel = EncryptionLevel.Aes128Bit;

            Assert.IsTrue(pdfTabViewModel.ExtendedPermissonsEnabled,
                          "Extended permissions disabled for 128BitAes encryption");
        }
Пример #4
0
        public void Rc40BitEncryption_ExtendedPermissionsDisabled()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.EncryptionLevel = EncryptionLevel.Rc40Bit;

            Assert.IsFalse(pdfTabViewModel.ExtendedPermissonsEnabled,
                           "Extended permissions enabled for low encryption");
        }
        private ProfileSettingsViewModelBundle BuildViewModelBundle(IInteractionInvoker invoker, ITranslator translator)
        {
            var documentTabViewModel = new DocumentTabViewModel(translator, invoker, Substitute.For <IFontHelper>());
            var saveTabViewModel     = new SaveTabViewModel(translator, invoker);
            var autoSaveTabViewModel = new AutoSaveTabViewModel(translator, invoker);
            var actionsTabViewModel  = new ActionsTabViewModel(translator);
            var imageTabViewModel    = new ImageFormatsTabViewModel(translator);
            var pdfTabViewModel      = new PdfTabViewModel(translator, invoker, Substitute.For <IFile>(), Substitute.For <IOpenFileInteractionHelper>());

            return(new ProfileSettingsViewModelBundle(documentTabViewModel, saveTabViewModel, autoSaveTabViewModel, actionsTabViewModel, imageTabViewModel, pdfTabViewModel));
        }
        private ProfileSettingsViewModelBundle BuildViewModelBundle(IInteractionInvoker invoker)
        {
            var documentTabViewModel = new DocumentTabViewModel(new DocumentTabTranslation(), invoker, Substitute.For <IFontHelper>(), new TokenHelper(new TokenPlaceHoldersTranslation()));
            var saveTabViewModel     = new SaveTabViewModel(new SaveTabTranslation(), invoker, new TokenHelper(new TokenPlaceHoldersTranslation()));
            var autoSaveTabViewModel = new AutoSaveTabViewModel(invoker, new AutosaveTabTranslation(), new TokenHelper(new TokenPlaceHoldersTranslation()));
            var actionsTabViewModel  = new ActionsTabViewModel(new ActionsTabTranslation());
            var imageTabViewModel    = new ImageFormatsTabViewModel(new ImageFormatsTabTranslation());
            var pdfTabViewModel      = new PdfTabViewModel(new PdfTabTranslation(), invoker, Substitute.For <IFile>(), Substitute.For <IOpenFileInteractionHelper>(), new EditionHintOptionProvider(true), Substitute.For <IPdfProcessor>(), Substitute.For <IUserGuideHelper>());

            return(new ProfileSettingsViewModelBundle(documentTabViewModel, saveTabViewModel, autoSaveTabViewModel, actionsTabViewModel, imageTabViewModel, pdfTabViewModel));
        }
Пример #7
0
        public void Rc40BitEncryption_BooleanPropertiesToEnumTest()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            pdfTabViewModel.LowEncryptionEnabled = true;

            Assert.AreEqual(EncryptionLevel.Rc40Bit, pdfTabViewModel.CurrentProfile.PdfSettings.Security.EncryptionLevel, "LowEncryptionEnabled but EncryptionLevel is not Low40Bit");
            Assert.IsFalse(pdfTabViewModel.MediumEncryptionEnabled, "MediumEncryptionEnabled true for low encryption");
            Assert.IsFalse(pdfTabViewModel.HighEncryptionEnabled, "HighEncryptionEnabled true for low encryption");
        }
Пример #8
0
        public void Rc40BitEncryption_EnumToBooleanPropertiesTest()
        {
            var pdfTabViewModel = new PdfTabViewModel();

            pdfTabViewModel.CurrentProfile = new ConversionProfile();

            pdfTabViewModel.CurrentProfile.PdfSettings.Security.EncryptionLevel = EncryptionLevel.Rc40Bit;

            Assert.IsTrue(pdfTabViewModel.LowEncryptionEnabled,
                          "LowEncryptionEnabled false for low encryption");
            Assert.IsFalse(pdfTabViewModel.MediumEncryptionEnabled,
                           "MediumEncryptionEnabled true for low encryption");
            Assert.IsFalse(pdfTabViewModel.HighEncryptionEnabled,
                           "HighEncryptionEnabled true for low encryption");
        }