Esempio n. 1
0
        public void TestNodeTypeSelection()
        {
            TestView test_view = new TestView();
            TestModel test_model = new TestModel();
            IPresenter presenter = new GuiPresenter(test_view, test_model);

            presenter.Connect();

            presenter.NodeSelected(new List<string> { "2.1" });
            Assert.IsFalse(test_view.add_files_button_enabled);
            presenter.NodeSelected(new List<string> { "1.1" });
            Assert.IsTrue(test_view.add_files_button_enabled);
            presenter.NodeSelected(new List<string> { "1.2" });
            Assert.IsFalse(test_view.add_files_button_enabled);
        }
Esempio n. 2
0
        public void TestLoadButtonText()
        {
            TestView test_view = new TestView();
            TestModel test_model = new TestModel();
            IPresenter presenter = new GuiPresenter(test_view, test_model);

            presenter.Connect();

            presenter.NodeSelected(new List<string> { "2.1" });
            Assert.AreEqual("Decrypt and Download", test_view.load_button_text);
            presenter.NodeSelected(new List<string> { "1.1" });
            Assert.AreEqual("Encrypt and LoadAction", test_view.load_button_text);
            presenter.NodeSelected(new List<string> { "1.2" });
            Assert.AreEqual("Decrypt and Download", test_view.load_button_text);
        }
Esempio n. 3
0
        public void TestDownloadFile()
        {
            TestView test_view = new TestView();
            TestModel test_model = new TestModel();
            IPresenter presenter = new GuiPresenter(test_view, test_model);

            presenter.Connect();

            var test_file_path = new List<string> { "str1", "str2", "some file" };
            presenter.NodeSelected(test_file_path);
            presenter.LoadAction();

            Assert.AreEqual(test_file_path, test_model.hierarchy);
        }
Esempio n. 4
0
        public void TestPresenterUpload()
        {
            TestView test_view = new TestView();
            TestModel test_model = new TestModel();
            IPresenter presenter = new GuiPresenter(test_view, test_model);

            presenter.NodeSelected(new List<string>{"1.1"});
            presenter.LoadAction();
            Assert.IsTrue(test_model.uploaded);

            test_model.uploaded = false;
            presenter.NodeSelected(new List<string>{"2.1"});
            presenter.LoadAction();
            Assert.IsFalse(test_model.uploaded);
        }