Ejemplo n.º 1
0
        public ProgressPage(ProtectTaskPanePresenter presenter)
        {
            InitializeComponent();
            _presenter = presenter;
            _presenter.StatusUpdate += OnStatusUpdate;

        }
Ejemplo n.º 2
0
 public UnsupportedFilesPage(ProtectTaskPanePresenter presenter, PropertyChangedEventHandler propertyChanged)
 {
     InitializeComponent();
     _propertyChanged = propertyChanged;
     PropertyChanged += _propertyChanged;
     _presenter = presenter;
     InitializeTaskPane();
 }
Ejemplo n.º 3
0
        public CleanFilesControl(PropertyChangedEventHandler propertyChanged, ProtectTaskPanePresenter presenter)
            : base(propertyChanged, "Clean files", Resources.ico_clean_reg, Resources.ico_clean_hover, "Remove metadata")
        {
            _presenter = presenter;
            cbPerformAction.Enabled = false;

            InitializeComponent();
            InitializeControl();
        }
Ejemplo n.º 4
0
 public SupportedFilesPage(ProtectTaskPanePresenter presenter, PropertyChangedEventHandler propertyChanged)
 {
     InitializeComponent();
     _propertyChanged = propertyChanged;
     PropertyChanged += _propertyChanged;
     _presenter = presenter;
     _presenter.StatusUpdate += OnStatusUpdate;
     _presenter.CollectionChanged += OnCollectionChanged;
     
     InitializeTaskPane();
 }
        public void TestCloseTaskPaneCalled_02()
        {
            var supportsCleaning = TestUtils.CreateAttachment("SupportsCleaning.doc", "SupportsCleaning.doc", "1");

            var view = CreateViewMock();;
            view.Setup(x => x.CurrentPage).Returns(PageType.SupportedFiles);

            bool closeCalled = false;

            view.Setup(m => m.Close()).
                 Callback(() => closeCalled = true);
            var model = new ProtectTaskPaneModel();

            var presenter = new ProtectTaskPanePresenter(view.Object, model);
            presenter.AddAttachment(supportsCleaning);
            Assert.True(SpinWait.SpinUntil(() => presenter.Attachments.Count == 1, 30000));
            presenter.RemoveAttachment(supportsCleaning);

            SpinWait.SpinUntil(() => closeCalled, 30000);

            view.Verify(m => m.Close(), Times.Once());
        }
        public void TestCorrectPageShown_03()
        {
            var passwordProtected = TestUtils.CreateAttachment("password.docx", "password.docx", "1");
            var unsupported = TestUtils.CreateAttachment("unsupported.vsd", "unsupported.vsd", "3");

            var view = CreateViewMock();;
            view.Setup(x => x.CurrentPage).Returns(PageType.PasswordProtectedFiles);

            var pageShown = PageType.None;

            view.Setup(m => m.ShowPage(It.IsAny<PageType>())).
                 Callback((PageType value) => pageShown = value);

            var model = new ProtectTaskPaneModel();

            var presenter = new ProtectTaskPanePresenter(view.Object, model);
            presenter.AddAttachment(passwordProtected);
            presenter.AddAttachment(unsupported);
            Assert.True(SpinWait.SpinUntil(() => presenter.Attachments.Count == 2, 30000));
            presenter.RemoveAttachment(unsupported);

            Thread.Sleep(10000);

            view.Verify(m => m.ShowPage(PageType.SupportedFiles), Times.Never());
        }
        public void TestSupportedFilesShown_03()
        {
            var supportsCleaning1 = TestUtils.CreateAttachment("small.doc", "small.doc", "1");
            var supportsCleaning2 = TestUtils.CreateAttachment("SupportsCleaning.doc", "SupportsCleaning.doc", "2");

            var view = CreateViewMock();;
            view.Setup(x => x.CurrentPage).Returns(PageType.SupportedFiles);

            var pageShown = PageType.None;

            view.Setup(m => m.ShowPage(It.IsAny<PageType>())).
                 Callback((PageType value) => pageShown = value);

            var model = new ProtectTaskPaneModel();

            var presenter = new ProtectTaskPanePresenter(view.Object, model);
            presenter.AddAttachment(supportsCleaning1);
            presenter.AddAttachment(supportsCleaning2);

            presenter.RemoveAttachment(supportsCleaning1);

            Thread.Sleep(15000);

            view.Verify(m => m.ShowPage(PageType.SupportedFiles), Times.AtLeastOnce());
        }
        public void TestSupportedFilesShown_02()
        {
            var unsupported = TestUtils.CreateAttachment("unsupported.vsd", "unsupported.vsd", "1");
            var supportsCleaning = TestUtils.CreateAttachment("SupportsCleaning.doc", "SupportsCleaning.doc", "2");

            var view = CreateViewMock();;
            view.Setup(x => x.CurrentPage).Returns(PageType.UnsupportedFiles);

            var pageShown = PageType.None;

            view.Setup(m => m.ShowPage(It.IsAny<PageType>())).
                 Callback((PageType value) => pageShown = value);

            var model = new ProtectTaskPaneModel();

            var presenter = new ProtectTaskPanePresenter(view.Object, model);
            presenter.AddAttachment(unsupported);
            presenter.AddAttachment(supportsCleaning);
            Assert.True(SpinWait.SpinUntil(() => presenter.Attachments.Count == 2, 30000));
            presenter.RemoveAttachment(unsupported);

            SpinWait.SpinUntil(() => pageShown == PageType.SupportedFiles, 30000);

            view.Verify(m => m.ShowPage(PageType.SupportedFiles), Times.AtLeastOnce());
        }